Skip to content

Instantly share code, notes, and snippets.

View jippi's full-sized avatar

Christian Winther jippi

View GitHub Profile
@cutiful
cutiful / mastodon-ip.md
Last active August 31, 2025 17:41
Detecting the real IP of a Cloudflare'd Mastodon instance

Detecting the real IP of a Cloudflare'd Mastodon instance

NB: This will not work for instances that proxy outgoing requests!

Reading the docs

I wanted to find a way to detect the real IP address of a Mastodon/Pleroma/Misskey/etc instance hosted behind Cloudflare. How to do that? Well, it's federated, which means I can probably get it to send a request to a server of mine! And how to do that? I tried reading the ActivityPub spec. The following caught my attention:

Servers should not trust client submitted content, and federated servers also should not trust content received from a server other than the content's origin without some form of verification.

@lefthand
lefthand / rundeck-execution-trip
Created March 21, 2017 23:26
Shell script that will remove old Rundeck executions
#!/bin/bash
# for rundeck with mysql db
# keep last X executions for each job
KEEP=300
cd /var/lib/rundeck/logs/rundeck
JOBS=`find . -maxdepth 3 -path "*/job/*" -type d`
@yossorion
yossorion / what-i-wish-id-known-about-equity-before-joining-a-unicorn.md
Last active September 4, 2025 01:33
What I Wish I'd Known About Equity Before Joining A Unicorn

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

@thpham
thpham / migration.sh
Created March 27, 2015 12:05
Consul.io Leader discovery and election to invoque migration...
# check if leader exist (means associated session with the )
hasSession=$(curl -s http://localhost:8500/v1/kv/service/migration/leader | jq -r .[] | jq 'has("Session")')
if [ -z "$hasSession" ] || [ "$hasSession" = false ]; then
# create session
session=$(curl -s -X PUT -d '{"Name": "migration"}' http://localhost:8500/v1/session/create | jq -r .ID)
echo "session=$session"
leaderValue=$(curl -s http://localhost:8500/v1/kv/service/migration/leader | jq -r .[].Value | base64 --decode)
echo "leaderValue=$leaderValue"
if [ -z "$leaderValue" ] || [ "$leaderValue" != "JOB_DONE" ]; then
# try to put a lock
@josephzidell
josephzidell / route_paths.php
Last active January 3, 2016 17:59
Pathify CakePHP routes
<?php
function root_path() {
return '/';
}
function pathify() {
foreach ( Router::$routes as $route ) {
$parts = [];
if ( isset( $route->defaults['prefix'] ) && !is_null( $route->defaults['prefix'] ) ) {
$parts[] = $route->defaults['prefix'];
@plentz
plentz / nginx.conf
Last active October 22, 2025 16:10
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@petehamilton
petehamilton / metric_apps.md
Last active May 22, 2017 19:14
Useful Metric Dashboard Research Links

Dashboards

Charting

@codepunkt
codepunkt / rm-corrupt.sh
Created November 19, 2012 16:48
find/delete corrupt whisper-files
#!/bin/bash
options=('find' 'delete')
PS3='state your wish: '
echo -e "\nfind/delete corrupt whisper-files"
select opt in "${options[@]}"; do
case $REPLY in
[12] ) option=$opt; break;;
* ) exit;;
@jalaziz
jalaziz / graphite.nginx
Created October 12, 2012 03:24
uWSGI and nginx configuration for Graphite (assumes /opt/graphite/conf/graphite.wsgi.example has been renamed to /opt/graphite/conf/wsgi.py)
server {
listen 8080 default_server deferred;
charset utf-8;
access_log /var/log/nginx/graphite.access.log;
error_log /var/log/nginx/graphite.error.log;
root /opt/graphite/webapp;
location /static/admin/ {
@jippi
jippi / 1_interface.php
Created September 13, 2012 16:02
GearmanD => StatsD class
$GearmanStatus = new GearmanStatus();
$GearmanStatus->setStatsdConfig(array('host' => '127.0.0.1', 'port' => 8125, 'prefix' => 'gearmand', 'rate' => 1));
$GearmanStatus->setGearmanConfig(array('host' => '127.0.0.1', 'port' => 4730));
$GearmanStatus->setDebug(true || false);
$GearmanStatus->reset();
$GearmanStatus->getCounters();
$GearmanStatus->getStatus();
$GearmanStatus->getWorkers();
$GearmanStatus->getRawStatus();
$GearmanStatus->transmitCountersToStatsD();