A thread is a single sequence stream within a process. Threads are also called lightweight processes as they possess some of the properties of processes. Each thread belongs to exactly one process.
What STAR stands for
Situation - the situation you had to deal with
Task - the task you were given to do
Action - the action you took
Result - what happened as a result of your action and what you learned from the experience
Situation - the situation you had to deal with
Task - the task you were given to do
Action - the action you took
Result - what happened as a result of your action and what you learned from the experience
# Demonstrating (mis)use of special methods
class SillyClass:
def getitem(self, key):
""" Determines behavior of
return [True, False, True, False]
def pow(self, other):
""" Determines behavior of
return "Python Like You Mean It"
class SillyClass:
def getitem(self, key):
""" Determines behavior of
self[key] """return [True, False, True, False]
def pow(self, other):
""" Determines behavior of
self ** other """return "Python Like You Mean It"
terminal themes
https://github.com/YabataDesign/afterglow-theme
https://github.com/YorickPeterse/Autumn.vim ( preferd )
https://github.com/YabataDesign/afterglow-theme
https://github.com/YorickPeterse/Autumn.vim ( preferd )
GitHub
GitHub - YabataDesign/afterglow-theme: [DEPRECATED] A minimal dark Theme for Sublime Text 2 and 3
[DEPRECATED] A minimal dark Theme for Sublime Text 2 and 3 - YabataDesign/afterglow-theme
For effective security logging and monitoring, consider the following types of logging:
File Access: Who has viewed or downloaded a specific file?
Authentication Attempts: Have any incorrect authentication attempts occurred?
Login Activity: Who has logged in recently?
Unexpected Events: Have authentication events happened at unexpected times or from unexpected locations?
These types of logging help in detecting and responding to security breaches promptly.
File Access: Who has viewed or downloaded a specific file?
Authentication Attempts: Have any incorrect authentication attempts occurred?
Login Activity: Who has logged in recently?
Unexpected Events: Have authentication events happened at unexpected times or from unexpected locations?
These types of logging help in detecting and responding to security breaches promptly.
Server Side Request Forgery (SSRF) is a vulnerability that allows an attacker to coerce a server to send crafted requests to unintended destinations. When SSRF is present, attackers can send requests pretending to be the victim server, potentially accessing sensitive and administrative functions like internal API calls and database queries. To prevent SSRF, it's important to enforce an allowlist or blocklist for external resources, ensuring that only legitimate requests are processed.
ansible python interpreter
[labex@host project]$ ansible localhost -m setup -a "filter=ansible_distribution*"
localhost | SUCCESS => {
"ansible_facts": {
"ansible_distribution": "RedHat",
"ansible_distribution_file_parsed": true,
"ansible_distribution_file_path": "/etc/redhat-release",
"ansible_distribution_file_search_string": "Red Hat",
"ansible_distribution_file_variety": "RedHat",
"ansible_distribution_major_version": "9",
"ansible_distribution_release": "Plow",
"ansible_distribution_version": "9.6",
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": false
}
PSI - Pressure Stall Information
https://docs.kernel.org/accounting/psi.html
https://docs.kernel.org/accounting/psi.html
Programming Notes ✍️
PSI - Pressure Stall Information https://docs.kernel.org/accounting/psi.html
userspace monitor usage ex:
monitoring mem proc with 1s window tracking size and 150ms threshold which uses /proc/pressure to count the events of proc
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <poll.h>
#include <string.h>
#include <unistd.h>
/*
* Monitor memory partial stall with 1s tracking window size
* and 150ms threshold.
*/
int main() {
const char trig[] = "some 150000 1000000";
struct pollfd fds;
int n;
fds.fd = open("/proc/pressure/memory", O_RDWR | O_NONBLOCK);
if (fds.fd < 0) {
printf("/proc/pressure/memory open error: %s\n",
strerror(errno));
return 1;
}
fds.events = POLLPRI;
if (write(fds.fd, trig, strlen(trig) + 1) < 0) {
printf("/proc/pressure/memory write error: %s\n",
strerror(errno));
return 1;
}
printf("waiting for events...\n");
while (1) {
n = poll(&fds, 1, -1);
if (n < 0) {
printf("poll error: %s\n", strerror(errno));
return 1;
}
if (fds.revents & POLLERR) {
printf("got POLLERR, event source is gone\n");
return 0;
}
if (fds.revents & POLLPRI) {
printf("event triggered!\n");
} else {
printf("unknown event received: 0x%x\n", fds.revents);
return 1;
}
}
return 0;
}
monitoring mem proc with 1s window tracking size and 150ms threshold which uses /proc/pressure to count the events of proc
🕊1
socket alive ssh connection in multiplex env where multi connection have to be made
Host *
ControlMaster auto
ControlPath ~/.ssh/master-socket/%r@%h:%p
#ControlPath /run/user/%i/sshmasterconn-%C
#ControlPath ~/.ssh/%r@%h:%p
ControlPersist 3s
# Local Address Foreign Address State
# one connection
tcp 0 0 192.168.x.y:58913 192.168.x.z:22 ESTABLISHED
# two multiplexed connections
tcp 0 0 192.168.x.y:58913 192.168.x.z:22 ESTABLISHED
# three multiplexed connections
tcp 0 0 192.168.x.y:58913 192.168.x.z:22 ESTABLISHED
Table 2: SSH Connections, Multiplexed