Skip to content

Instantly share code, notes, and snippets.

<!-- Add this to the Head section of your super site -->
<script>
// Say we host our Super site in a subdirectory e.g. https://example.com/blog
// We can redirect it properly in Cloudflare Worker, but relative links will break
// So we require some custom code to override absolute href paths & history state changes
if (window.location.origin === 'https://example.com') {
var baseDir = '/blog';
function historyMethodOverride(target, thisArg, argArray) {
// prepend baseDir if it isn't there
@infernalheaven
infernalheaven / poc.c
Created September 16, 2021 02:18
macOS 11.5.2/iOS 14.7.1 Kernel Race Condition poc
/*
Written By Pan ZhenPeng(@peterpan980927) of Alibaba Security Pandora Lab
use it on macOS: cc poc.c -o poc while True; do ./poc ; done
*/
#include <errno.h>
#include <signal.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
@hashworks
hashworks / kutt.sh
Created November 6, 2020 17:25
BASH function for kutt.it URL shortener services
KUTT_HOST="https://kutt.it"
KUTT_API_KEY="API_KEY"
kutt() {
if [[ "$1" == "delete" ]] && [[ -n "$2" ]]; then
curl -s -H "X-API-KEY: $KUTT_API_KEY" \
-X DELETE \
"$KUTT_HOST/api/v2/links/$2" | jq
elif [[ -z "$1" ]]; then
curl -s -H "X-API-KEY: $KUTT_API_KEY" \
"$KUTT_HOST/api/v2/links" | jq
@qzm
qzm / aria2.conf
Last active April 11, 2024 01:35
Best aria2 Config
### Basic ###
# The directory to store the downloaded file.
dir=${HOME}/Downloads
# Downloads the URIs listed in FILE.
input-file=${HOME}/.aria2/aria2.session
# Save error/unfinished downloads to FILE on exit.
save-session=${HOME}/.aria2/aria2.session
# Save error/unfinished downloads to a file specified by --save-session option every SEC seconds. If 0 is given, file will be saved only when aria2 exits. Default: 0
save-session-interval=60
# Set the maximum number of parallel downloads for every queue item. See also the --split option. Default: 5
@mayneyao
mayneyao / notion2blog.js
Last active February 29, 2024 18:01
Notion.so > Personal Blog | custom domain + disqus comment
const MY_DOMAIN = "agodrich.com"
const START_PAGE = "https://www.notion.so/gatsby-starter-notion-2c5e3d685aa341088d4cd8daca52fcc2"
const DISQUS_SHORTNAME = "agodrich"
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
@spiroski
spiroski / autossh
Created March 4, 2018 19:20
Script alternative to autossh
#!/bin/bash
# ------------------------------------------------------------------------------
# FILE: autossh
# DESCRIPTION: This is an SSH-D proxy with auto-reconnect on disconnect
# AUTHOR: Hector Nguyen (hectornguyen at octopius dot com)
# VERSION: 1.0.0
# ------------------------------------------------------------------------------
VERSION="1.0.0"
GITHUB="https://github.com/hectornguyen/autossh"
AUTHOR="Hector Nguyen"
@joepie91
joepie91 / vpn.md
Last active April 20, 2024 21:15
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.