Skip to content

Instantly share code, notes, and snippets.

View yaodong's full-sized avatar

Yaodong Zhao yaodong

View GitHub Profile
{
"nodes": [
{"id": "Myriel", "group": 1},
{"id": "Napoleon", "group": 1},
{"id": "Mlle.Baptistine", "group": 1},
{"id": "Mme.Magloire", "group": 1},
{"id": "CountessdeLo", "group": 1},
{"id": "Geborand", "group": 1},
{"id": "Champtercier", "group": 1},
{"id": "Cravatte", "group": 1},
@yaodong
yaodong / google_uname_tester.py
Created January 12, 2017 18:01
google user name tester
from time import sleep
import subprocess, json
import string
username_prefix = "prefix1234"
cmd = """curl 'https://accounts.google.com/InputValidator?resource=SignUp&service=mail' -H 'Referer: https://accounts.google.com/SignUp?service=mail&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&ltmpl=default' -H 'Origin: https://accounts.google.com' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36' -H 'Content-type: application/json' --data-binary '{"input01":{"Input":"GmailAddress","GmailAddress":"__name__","FirstName":"","LastName":""},"Locale":"en"}' --compressed"""
for i in range(10, 100):
def rotate(row, angle, dim1, dim2):
radian = angle * pi / 180.
cos_alpha, sin_alpha = cos(radian), sin(radian)
x, y = row[dim1], row[dim2]
row[dim1] = cos_alpha * x - sin_alpha * y
row[dim2] = sin_alpha * x + cos_alpha * y
return row
def cartesian_to_spherical(x, y, z):
@yaodong
yaodong / tmux.conf
Created February 21, 2017 07:12
backup of tmux #temp
###########################
# Configuration
###########################
# use 256 term for pretty colors
set -g default-terminal "screen-256color"
# increase scroll-back history
set -g history-limit 5000
@yaodong
yaodong / 1_cmake.log
Created February 23, 2017 21:39
installation of dipha
-- The C compiler identification is AppleClang 8.0.0.8000042
-- The CXX compiler identification is AppleClang 8.0.0.8000042
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works
@yaodong
yaodong / celery_nested_tasks.py
Created March 4, 2017 06:29
celery workflow test #temp
from celery import shared_task, chord, chain, group
@shared_task()
def workflow_test(*args, name="", time=2):
print('name [%s] %s' % (name, args))
sleep(time)
return name
chord(
header=group(
FooMixin = Ember.Mixin.create({
init: function () {
this._super(); // This will call Em.Object#init in the super chain
console.log('FooMixin#init');
}
});
BarMixin = Ember.Mixin.create({
init: function () {
this._super(); // This will call FooMixin#init in the super chain
docker run -it --rm --name certbot \
-v "/etc/letsencrypt:/etc/letsencrypt" \
-v "/var/lib/letsencrypt:/var/lib/letsencrypt" \
-p 80:80 \
certbot/certbot certonly
class Solution {
public int[] findDiagonalOrder(int[][] matrix) {
if (matrix.length == 0) {
return new int[0];
}
int m = matrix.length, n = matrix[0].length;
int[] result = new int[m*n];
@yaodong
yaodong / r1.py
Last active September 9, 2018 05:04
{'_node': 'spore-print-color',
'decisions': [['k',
{'_node': 'gill-size',
'decisions': [['n',
{'_node': 'population',
'decisions': [['s', {'label': 'p'}],
['v',
{'_node': 'cap-surface',
'decisions': [['y',
{'label': 'p'}],