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 March 21, 2024 04:00
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 April 7, 2024 22:55
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'];
@hgfischer
hgfischer / benchmark+go+nginx.md
Last active April 11, 2024 22:09
Benchmarking Nginx with Go

Benchmarking Nginx with Go

There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.

So, these are the different settings we are going to compare:

  • Go HTTP standalone (as the control group)
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI
@plentz
plentz / nginx.conf
Last active April 24, 2024 11:15
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/ {