Skip to content

Instantly share code, notes, and snippets.

@doio
doio / gh-dl-release
Created June 4, 2018 12:26 — forked from metral/gh-dl-release
Download assets from private Github releases
#!/usr/bin/env bash
#
# gh-dl-release! It works!
#
# This script downloads an asset from latest or specific Github release of a
# private repo. Feel free to extract more of the variables into command line
# parameters.
#
# PREREQUISITES
#
@doio
doio / gh-dl-release
Created June 4, 2018 11:49 — forked from maxim/gh-dl-release
Download assets from private Github releases
#!/usr/bin/env bash
#
# gh-dl-release! It works!
#
# This script downloads an asset from latest or specific Github release of a
# private repo. Feel free to extract more of the variables into command line
# parameters.
#
# PREREQUISITES
#
@doio
doio / sinaimg.js
Created December 22, 2017 08:14 — forked from mysteriouss/sinaimg.js
// ==UserScript==
// @name sinaimg
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match *://*.sinaimg.cn/*
// @grant none
// ==/UserScript==
@doio
doio / pem_to_hkpk.md
Created December 18, 2017 06:14 — forked from esurdam/pem_to_hkpk.md
Generate HKPK from pem encoded certs (letsencrypt, digicert, etc)

HPKP from .pem (letsecnrypt)

Generate from your letsencrypt certs.

HKPK (RFC7469) is a standard that tells browser to cache a certain TLS certificate’s signature, and validate that future visits use that certificate. Please read Extended Info as losing your pins may result in migraines (if you use your leaf) You can check or generate your hashes with this tool

letsencrypt renews your certificates every few months, so if you pin against your cert.pem and it changes (or you lose it), the browser will still expect to see the old one.

@doio
doio / gist:7441cd668b4cae538903a7734def50f8
Created October 13, 2017 07:41 — forked from kyledrake/gist:d7457a46a03d7408da31
Creating a self-signed SSL certificate, and then verifying it on another Linux machine
# Procedure is for Ubuntu 14.04 LTS.
# Using these guides:
# http://datacenteroverlords.com/2012/03/01/creating-your-own-ssl-certificate-authority/
# https://turboflash.wordpress.com/2009/06/23/curl-adding-installing-trusting-new-self-signed-certificate/
# https://jamielinux.com/articles/2013/08/act-as-your-own-certificate-authority/
# Generate the root (GIVE IT A PASSWORD IF YOU'RE NOT AUTOMATING SIGNING!):
openssl genrsa -aes256 -out ca.key 2048
openssl req -new -x509 -days 7300 -key ca.key -sha256 -extensions v3_ca -out ca.crt
@doio
doio / ca.md
Created October 12, 2017 10:11 — forked from soarez/ca.md
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@doio
doio / decrypt.rb
Created September 8, 2017 09:13 — forked from refractalize/decrypt.rb
Decrypt HTTP Live Streaming TS files
def read_m3u8(m3u8)
File.open(m3u8, 'r') do |file|
keyfile = nil
iv = 0
file.each_line do |line|
line.chomp!
if line =~ /^#EXT-X-KEY:METHOD=AES-128,URI="(.*?)"(,IV=0x(.*))?/
keyfile = $1
if $2
iv = $3
@doio
doio / sepsplit.c
Created August 20, 2017 07:22 — forked from xerub/sepsplit.c
/*
* SEP firmware split tool
*
* Copyright (c) 2017 xerub
*/
#include <fcntl.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
@doio
doio / ss-packets.md
Created July 23, 2017 11:48
ss与ssr的收发包记录

格式说明

twitter.com:443 u 23 517 d 154 u 51 53 98 809 d 44
从左向右看
首先twitter.com:443表示访问twitter.com的443端口,即https
上传方向(以字母u表示),先发送23字节,再发517字节,
然后下载方向(以字母d表示),收到154字节,
接着上传方向再上传51、53、98、809字节,
最后下载方向收到44字节后,连接断开。
一行内容即为一次连接的记录

@doio
doio / gist:dae2f63ae762c42bdd90519fc2e0fe78
Created July 15, 2017 16:04
Uninstall XQuartz.app from OSX Yosemite/El Capitan/Sierra
launchctl unload /Library/LaunchAgents/org.macosforge.xquartz.startx.plist && \
sudo launchctl unload /Library/LaunchDaemons/org.macosforge.xquartz.privileged_startx.plist && \
sudo rm -rf /opt/X11* /Library/Launch*/org.macosforge.xquartz.* /Applications/Utilities/XQuartz.app /etc/*paths.d/*XQuartz && \
sudo pkgutil --forget org.macosforge.xquartz.pkg && \
rm -rf ~/.serverauth* && rm -rf ~/.Xauthorit* && rm -rf ~/.cache && rm -rf ~/.rnd && \
rm -rf ~/Library/Caches/org.macosforge.xquartz.X11 && rm -rf ~/Library/Logs/X11