Skip to content

Instantly share code, notes, and snippets.

View detailyang's full-sized avatar
💭
copy magic from Github

detailyang detailyang

💭
copy magic from Github
View GitHub Profile
@detailyang
detailyang / debugger pause beforeunload
Created January 29, 2018 07:52 — forked from carcinocron/debugger pause beforeunload
Chrome: pause before redirect
// Run this in the F12 javascript console in chrome
// if a redirect happens, the page will pause
// this helps because chrome's network tab's
// "preserve log" seems to technically preserve the log
// but you can't actually LOOK at it...
// also the "replay xhr" feature does not work after reload
// even if you "preserve log".
window.addEventListener("beforeunload", function() { debugger; }, false)
Verifying my Blockstack ID is secured with the address 1F6fE5yVARL1JUuEEKkerF6H3uAHQ8afya https://explorer.blockstack.org/address/1F6fE5yVARL1JUuEEKkerF6H3uAHQ8afya
@detailyang
detailyang / gist:8f8574d630b936be892747fbffa2846f
Created October 7, 2017 14:29
ecdsa sign message to help picops transfer kyc
const e = require("ethereumjs-util")
const priv = Buffer.from('you 32 bytes private key', 'hex')
const hash = e.sha256("2017-10-07-picops-recertify")
const sig = e.ecsign(hash, priv)
const pub = e.ecrecover(hash, sig.v, sig.r, sig.s)
console.log('v', sig.v)
console.log('r', sig.r.toString('hex'))
console.log('s', sig.s.toString('hex'))
console.log(e.publicToAddress(pub).toString('hex'))
@detailyang
detailyang / gist:67baddb8cfd6bf9b98c11e85862449ba
Created September 1, 2017 12:58
0x75DfEf61A45235C714914f3E279A61922D5c325F
0x75DfEf61A45235C714914f3E279A61922D5c325F
### Keybase proof
I hereby claim:
* I am detailyang on github.
* I am detailyang (https://keybase.io/detailyang) on keybase.
* I have a public key whose fingerprint is 035C 5295 6F34 8BE1 932F 2C9A E65A A22D 9E20 503F
To claim this, I am signing this object:
@detailyang
detailyang / gist:170b1f55bd68f9ea6a83
Last active August 22, 2016 06:39
bash is_localhost
function is_localhost() {
localhost=$(ping -c1 $1 | head -n 1 | grep '127.0.0.1')
if [[ -z "$localhost" ]] ; then
echo 0;
else
echo 1;
fi
}
res=$(is_localhost "osx.com");
@detailyang
detailyang / gist:0efa9adb7e3d9cc16f8c
Last active August 29, 2015 14:01
kdt daily top
#!/bin/bash
# num of error log
if [ $1 ];then
num=$1
else
num=100
fi
#today error log name
@detailyang
detailyang / gist:9656858
Created March 20, 2014 03:53
git log colorful
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --"
@detailyang
detailyang / gist:9460999
Created March 10, 2014 07:45
logstash nginx grok pattern
NGINX_ACCESS %{SYSLOGTIMESTAMP:syslog_timestamp}\s*%{SYSLOGHOST:server}\s*%{SYSLOGPROG}:\s*%{IPORHOST:balanced_ip} - - \[%{HTTPDATE}\]\s*"%{WORD:method}\s*%{URIPATHPARAM:request}\s*HTTP/%{NUMBER:http_version}"\s*%{NUMBER:res}\s*%{NUMBER:send_bytes}\s*"(?<referer>.*?)"\s*%{QS:agent}\s*"(?<client_ip>.*?)"\s*%{WORD:unknow}\s*%{QS:cookie}\s*"(?<timestamp>.*?)"
@detailyang
detailyang / gist:7959399
Created December 14, 2013 13:56
django test
from django.test import TestCase
from django.utils import timezone
from django.core.urlresolvers import reverse
import datetime
# Create your tests here.
from polls.models import Poll
class PollMethodTests(TestCase):
def test_was_published_recently_with_future_poll(self):