Skip to content

Instantly share code, notes, and snippets.

@chocolatkey
chocolatkey / ok.json
Created January 30, 2019 19:53
just a nice response
{"status":"200"}
@chocolatkey
chocolatkey / cron_optim.py
Created November 19, 2018 20:47
Automatically optimize images with guetzli
# -*- coding: utf-8 -*-
# Cron Image optimizer
# chocolatkey (Henry) 2018-11-13
version = "1.1.0"
THREADS = 8
GUETZLI = "/opt/optim/guetzli"
BASE = "/data/cache"
LOCK_FILE = BASE + "/optim.lock"
@chocolatkey
chocolatkey / nginx_secure_url.go
Last active December 11, 2019 09:22
Generate signed URIs for a client to access links secured with ngx_http_secure_link_module
/**
Example of how to configure Nginx for signed urls. Make sure to replace YOUR_URL_SECRET_KEY_HERE with your url signing key
location /secrets/ {
# Headers for debugging
add_header X-Secure-Uri "$uri";
add_header X-Secure-Ip "$remote_addr";
add_header X-Secure-Expires "$arg_expires";
@chocolatkey
chocolatkey / drive:v2internal.json
Last active September 24, 2022 12:21
No, I don't work at Google
{
"kind": "discovery#restDescription",
"discoveryVersion": "v1",
"id": "drive:v2internal",
"name": "drive",
"version": "v2internal",
"revision": "20180702",
"title": "Drive API",
"description": "Manages files in Drive including uploading, downloading, searching, detecting changes, and updating sharing permissions.",
"ownerDomain": "google.com",
// ==UserScript==
// @name WebNovel video ad bypasser
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Bypass the video ads on webnovel.com
// @author chocolatkey
// @match https://www.webnovel.com/book*
// @grant none
// @downloadURL https://gist.github.com/chocolatkey/b6e6e89eae3fb216d0198a71069a27b7/raw
// @supportURL https://gist.github.com/chocolatkey/b6e6e89eae3fb216d0198a71069a27b7
@chocolatkey
chocolatkey / .bashrc
Created October 14, 2017 23:54
babbage bash config
# Only load Liquid Prompt in interactive shells, not from a script or from scp
[[ $- = *i* ]] && source ~/liquidprompt/liquidprompt
# Muh colors!
alias grep='grep --color' # show differences in colour alias
egrep='egrep --color=auto' # show differences in colour
alias fgrep='fgrep --color=auto' # show differences in colour
alias ls='ls -hF --color=tty' # classify files in colour
alias dir='ls --color=auto --format=vertical'
alias vdir='ls --color=auto --format=long'
<?php echo phpinfo();
@chocolatkey
chocolatkey / scribdrip.py
Created September 11, 2017 03:23
Scribd document ripper
# -*- coding: utf-8 -*-
# Scribd Ripper 1.0
# chocolatkey 2017
import requests
import re
import http.cookiejar
import sys
import time
from bs4 import BeautifulSoup
@chocolatkey
chocolatkey / bans.conf
Last active February 26, 2019 21:37
*cough* *cough*
deny 76.98.228.66;
deny 2606:6000:6a88:3900:4dd:8c38:6a:c25b;
deny 2606:6000:6a88:3900:b9ba:afb8:1ade:5c73;
deny 2606:6000:6a88:3900:8c94:e7c5:c8f4:5902;
deny 67.169.9.227;
deny 108.161.118.115;
deny 192.186.154.250; # mangatail
deny 104.131.76.147; # jonas747.com
deny 51.15.67.110;
deny 2607:f2c0:9506:2100:88ba:82d:6869:d089;
@chocolatkey
chocolatkey / chgrub2env.sh
Created June 2, 2017 23:07
Change Grub2 default menu entry
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
echo "=================================="
echo "Grub2 selected menu entry changer"
echo "=================================="
cenvraw=$(grub2-editenv list)
cenv=${cenvraw#*=}