Skip to content

Instantly share code, notes, and snippets.

@safly
safly / README.md
Created August 4, 2025 06:27 — forked from prestonw/README.md
Speedtest against Hetzner servers

Hetzner Speedtest

This Python application serves as a rudimentary speed test utility designed to evaluate network performance against public Hetzner endpoints. The tool not only measures download speeds but also provides approximate latency metrics to various Hetzner data centers for a comprehensive network assessment.

usage

python hetzner-speedtest.py [lg|md|sm] -v

-v is optional to enter verbose mode

@safly
safly / asn.js
Created October 11, 2020 00:36 — forked from johannrichard/asn.js
Serverless Worker Function for ASN prefix parsing for OPNsense and pfSense
/***
* Worker Function for ASN prefix parsing
* Will query the BigIP API for a given ASN and return a plain-text representation of the ASN prefixes
* (IP ranges) that can be used in either OPNsense or pfSense URL Tables (Firewall alias).
*
* See https://docs.opnsense.org/manual/aliases.html (OPNsense) and https://docs.netgate.com/pfsense/en/latest/firewall/aliases.html (pfSense) for details of their use.
*
* You can deploy this worker for example on the free tier of CloudFlare (Up to 100'000 requests a day) or
* any other serverless platform that supports JavaScript
*
@safly
safly / nginx.conf
Created March 4, 2020 01:10 — forked from theMiddleBlue/nginx.conf
Nginx human user recognition
server {
listen 80;
server_name example.com;
encrypted_session_key 'v1-clG~!~v7B_Z0yu.:iw*Rj#l-Nc8E^';
encrypted_session_iv "themiddlerfvbgt5";
encrypted_session_expires 20;
location ~ /botbuster.js {
default_type 'text/javascript';
@safly
safly / iptables.sh
Created February 9, 2020 08:50 — forked from m4vr0x/iptables.sh
Proxmox iptables rules script
#!/bin/sh
# ---------
# VARIABLES
# ---------
## Proxmox bridge holding Public IP
PrxPubVBR="vmbr0"
## Proxmox bridge on VmWanNET (PFSense WAN side)
PrxVmWanVBR="vmbr1"
@safly
safly / README.md
Created February 5, 2020 05:26 — forked from lepture/README.md
Is in China

Detecting if current browser is in China

Use the script below:

isInChina(function(inChina) {
  console.log('In china: ' + inChina);
})
@safly
safly / upgrade-openssh-7.3p1-centos-6.7.sh
Created February 3, 2020 03:15 — forked from faishal/upgrade-openssh-7.3p1-centos-6.7.sh
Upgrade OpenSSH to 7.3p1 in Cent OS 6
#!/bin/bash
# Copyright © 2016 Faishal Saiyed
cd
timestamp=$(date +%s)
if [ ! -f openssh-7.3.zip ]; then wget https://github.com/faishal/openssh-portable/releases/download/cent.os.6.7.openssh.7.3p1/openssh-7.3.zip; fi;
unzip -o openssh-7.3.zip -d openssh-7.3p1
cd openssh-7.3p1/
cp /etc/pam.d/sshd pam-ssh-conf-$timestamp
rpm -U *.rpm
yes | cp pam-ssh-conf-$timestamp /etc/pam.d/sshd
@safly
safly / gunzip.conf
Created January 31, 2020 13:26 — forked from ryd994/gunzip.conf
server {
listen unix:/var/run/nginx-gunzip.sock;
location / {
proxy_set_header Accept-Encoding gzip;
proxy_pass http://$host$request_uri;
gunzip on;
access_log off;
}
}
// This will open up a prompt for text to send to a console session on digital ocean
// Useful for long passwords
(function () {
var t = prompt("Enter text to be sent to console, (This wont send the enter keystroke)").split("");
function f() {
var character = t.shift();
var i=[];
var code = character.charCodeAt();
var needs_shift = "!@#$%^&*()_+{}:\"<>?~|".indexOf(character) !== -1
@safly
safly / astro-portal.php
Created November 4, 2019 12:22 — forked from yymao/astro-portal.php
astro portal: search for arXiv, DOI, ADS bibcode, and first author + year, without typing syntax keywords!
<?php
if(isset($_GET['q'])){
$url_base = 'https://ui.adsabs.harvard.edu/#search/q=';
#doi
$re = '/\b10\.\d{4,}(?:\.\d+)*\/(?:(?![\'"&<>])\S)+/';
if (preg_match($re, $_GET['q'], $matches)){
if (isset($_GET['rd'])){
$url = $url_base . 'doi%3A' . urlencode($matches[0]);
}