start new:
tmux
start new with session name:
tmux new -s myname
#!/usr/bin/env python3 | |
""" | |
Script to test HTTP mirrors of Cygwin by measuring download times. | |
Originally written in 2011, modernized in 2025. | |
""" | |
from math import floor | |
from urllib.request import urlopen | |
import argparse | |
import sys |
#!/bin/bash | |
# nexusdeb builds a debian package of the Nexus repository manager. nexusdeb | |
# downloads nexus by itself. You run it by | |
# nexusdeb.sh <version> <maintainer> | |
# Example: | |
# nexusdeb.sh 2.0.5 "Denny Colt <[email protected]>" | |
# | |
# The script has been tested with version 2.0.5. | |
if [ -z $1 ] |
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
monitor: bundle exec ruby monitor.rb |
Let's say somebody temporarily got root access to your system, whether because you "temporarily" gave them sudo rights, they guessed your password, or any other way. Even if you can disable their original method of accessing root, there's an infinite number of dirty tricks they can use to easily get it back in the future.
While the obvious tricks are easy to spot, like adding an entry to /root/.ssh/authorized_keys, or creating a new user, potentially via running malware, or via a cron job. I recently came across a rather subtle one that doesn't require changing any code, but instead exploits a standard feature of Linux user permissions system called setuid to subtly allow them to execute a root shell from any user account from the system (including www-data
, which you might not even know if compromised).
If the "setuid bit" (or flag, or permission mode) is set for executable, the operating system will run not as the cur
Simple way to setup an arm chroot for building packages for your arm devices. This is an alternative to cross-compiling where you are limited to only linking against the libs in your toolchain.
You can store the chroot wherever you like. I choose to store it in a disk-image which I mount to my filesystem.
#!/bin/bash | |
WPA_SUPPLICANT_CONF="/etc/wpa_supplicant/wpa_supplicant.conf" | |
# this funcion is called once the connection is established, | |
# in this case a boot sound will be played to notify the user that everything is ready. | |
function connected { | |
aplay /root/Windows3.1.wav 2>&1 >/dev/null & | |
} |
# | |
# Proof of concept for a HAProxy maintenance mode | |
# | |
# | |
# Control the maintenance page during runtime using the stats socket: | |
# | |
# To put the whole site in maintenance mode (for all IPs): | |
# > add acl #0 0.0.0.0/0 | |
# | |
# To exclude your own ip, so you are able to test things out: |
To send the ip addres of the client/webbrowser to the server/webserver behind it there are a few options: | |
1- option forwardfor | |
2- send-proxy | |
3- source 0.0.0.0 usesrc clientip | |
1- option forwardfor | |
This is an easy option to configure in haproxy, it does require that http layer7 processing is used 'mode http' and the webserver/ webapplication that wants to log or use the ip of the client must use the http-header 'X-Forwarded-For' to read the clientip. | |
2- send-proxy / send-proxy-v2 / send-proxy-* | |
This is can be used both with mode tcp and http, it does however require that the server also understands the proxyprotocol. Some applications have added support for this protocol which adds a few bytes with ip information before the actual request. |