Skip to content

Instantly share code, notes, and snippets.

Adam Lau welladamm

Block or report user

Report or block welladamm

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View update_cert_hook.sh
#!/bin/bash
# @author: http://github.com/welladamm/
CERT_NAME="you_domain.com"
LOCAL_DIR=$(cd $(dirname $0); pwd -P)
LOCAL_CERT_DIR="$LE_WORKING_DIR/$CERT_NAME"
SSH="ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -q"
SCP="scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -q"
@welladamm
welladamm / renew_ilo.sh
Created Jun 5, 2018 — forked from sebva/renew_ilo.sh
Renew/assign a Let's Encrypt certificate on an HP iLO 4 system
View renew_ilo.sh
#!/bin/zsh
# Needs https://github.com/lukas2511/letsencrypt.sh in dns-01 mode
/opt/letsencrypt/ilo/letsencrypt.sh -c -s /opt/letsencrypt/ilo/ilo.csr -k /opt/letsencrypt/ilo/hook.sh -t dns-01 > /opt/letsencrypt/ilo/ilo.crt
cert=$(cat /opt/letsencrypt/ilo/ilo.crt)
curl --cacert /opt/letsencrypt/intermediate.pem -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic [FILL_IN_HERE]" -X POST -d "{\"Action\": \"ImportCertificate\", \"Certificate\": \"$cert\"}" https://ilo.home.vaucher.org/rest/v1/Managers/1/SecurityService/HttpsCert
View rm.sh
#!/usr/bin/env bash
RM=/bin/.rm
DATE=$(date '+%Y%m%d%H%M%S')
USER=$(whoami)
CMD=$(ps -eo pid,lstart,cmd |grep $PPID |grep -v grep)
ARGS="$@"
echo "${DATE} ${USER} ${ARGS} ${CMD}" >> /tmp/rm.log
${RM} "$@"
exit $?
@welladamm
welladamm / .gitconfig
Last active Jan 13, 2016
~/.gitconfig
View .gitconfig
[user]
name = Name
email = user@example.com
[push]
default = matching
[mergetool]
keepBackup = true
[merge]
tool = sourcetree
[core]
View keybase.md

Keybase proof

I hereby claim:

  • I am welladamm on github.
  • I am welladam (https://keybase.io/welladam) on keybase.
  • I have a public key whose fingerprint is 8054 1466 86CA C7EB 09FE D22F 7BCD E404 3704 337F

To claim this, I am signing this object:

@welladamm
welladamm / surge.conf
Last active Oct 16, 2015 — forked from soffchen/surge.conf
surge.conf
View surge.conf
[General]
skip-proxy = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, localhost, *.local
bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12
dns-server = 119.29.29.29, 223.5.5.5, 114.114.114.114
loglevel = notify
[Proxy]
Proxy = custom
[Rule]
View gist:21d8e5e2b31c2b310887
*.cn DirectConnection
*tmall* DirectConnection
.10010.com DirectConnection
.10050.net DirectConnection
.115.com DirectConnection
.115img.com DirectConnection
.123cha.com DirectConnection
.126.com DirectConnection
.126.net DirectConnection
.163.com DirectConnection
View hostsRequestedCounts
var har = require('./har.json');
var entries = har['log']['entries'];
var hosts = {};
for (var i = 0; i < entries.length; i++) {
var entry = entries[i];
var headers = entry['request']['headers'];
for (var j = 0; j < headers.length; j++) {
var header = headers[j];
if (header['name'] == 'Host') {
View whitelist.pac
/*
* A white-list based PAC without regexp, by @janlay
* It's just simple and fast.
* Last update: Dec 3, 2013
* Special thanks to @Paveo
*/
function FindProxyForURL(url, host) {
var PROXY = "PROXY 127.0.0.1:8800";
var DEFAULT = "DIRECT";
@welladamm
welladamm / OS X Defaults Tricks.md
Last active Dec 27, 2015
Useful defaults tricks for OS X
View OS X Defaults Tricks.md

对所有网络接口启用 Airdrop (黑苹果有效)

defaults write com.apple.NetworkBrowser BrowseAllInterfaces 1

阻止 Terminal 恢复窗口

You can’t perform that action at this time.