Skip to content

Instantly share code, notes, and snippets.

View hamjin's full-sized avatar

hamjin hamjin

View GitHub Profile
#!/usr/bin/env python
import struct
import sys
import os
if len(sys.argv) < 2:
print('Usage: ' + os.path.basename(sys.argv[0]) + ' input_file')
exit()
@hamjin
hamjin / fast_repo_sync.sh
Last active April 29, 2024 09:02
Faster repo sync
repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/kernel/manifest -b common-android12-5.10 --git-lfs --repo-url='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo' --no-tags --current-branch --depth=1
repo sync -j1 --force-sync --fail-fast --no-tags --current-branch -v
@hamjin
hamjin / cloudflare-update-record.sh
Last active October 15, 2017 00:01 — forked from benkulbertis/cloudflare-update-record.sh
Cloudflare API v4 Dynamic DNS Update in Bash
#!/bin/bash
# CHANGE THESE
auth_email="user@example.com"
auth_key="c2547eb745079dac9320b638f5e225cf483cc5cfdda41" # found in cloudflare account settings
zone_name="example.com"
record_name="www.example.com"
# MAYBE CHANGE THESE
ip=$(curl -s https://api-ipv4.ip.sb/ip)
@hamjin
hamjin / ddns.sh
Last active October 14, 2017 23:53 — forked from lyoshenka/ddns.sh
Quick and dirty DDNS using Bash and Cloudflare (API v4 compatible)
#!/usr/bin/env bash
# Step 1: Fill in EMAIL, TOKEN, DOMAIN and SUBDOMAIN. Your API token is here: https://www.cloudflare.com/a/account/my-account
# Make sure the token is the Global token, or has these permissions: #zone:read, #dns_record:read, #dns_records:edit
# Step 2: Create an A record on Cloudflare with the subdomain you chose
# Step 3: Run "./ddns.sh -l" to get the zone_id and rec_id of the record you created.
# Fill in ZONE_ID and REC_ID below
# This step is optional, but will save you 2 requests every time you this script
# Step 4: Run "./ddns.sh". It should tell you that record was updated or that it didn't need updating.
# Step 5: Run it every hour with cron. Use the '-s' flag to silence normal output
haproxy.conf
============
frontend spdy
mode tcp
bind xxx.xxx.xxx.xxx:443 ssl crt /etc/haproxy/ssl.pem crt /etc/haproxy/certs.d npn spdy/3.1,http/1.1 ciphers AES256+EECDH:AES256+EDH:AES128+EDH:EECDH:!aNULL:!eNULL:!LOW:!DES:!3DES:!RC4; no-sslv3
option tcplog
log global
# route to nginx