Skip to content

Instantly share code, notes, and snippets.

Avatar

Yuchen Ying yegle

  • Google
  • San Francisco Bay Area
View GitHub Profile
View gist:9ac2bf04fcf73bb9bc8b3ce15e63a4c6
$ curl -I https://www.autonomous.ai -H 'accept-language: en,zh-CN;q=0.9,zh;q=0.8'
HTTP/2 500
server: nginx
date: Wed, 27 May 2020 06:46:20 GMT
content-type: text/html; charset=utf-8
content-length: 58788
set-cookie: lang=zh-CN; Max-Age=315360000; Path=/; Expires=Sat, 25 May 2030 06:46:20 GMT
access-control-allow-origin: *
access-control-allow-methods: GET, POST, OPTIONS, PUT, PATCH, DELETE
access-control-allow-headers: X-Requested-With,content-type
View keybase.md

Keybase proof

I hereby claim:

  • I am yegle on github.
  • I am yegle (https://keybase.io/yegle) on keybase.
  • I have a public key ASA_sLGmpOa5Duyf2sYyu-22gA5UrZf_4dlrv7FG6619FAo

To claim this, I am signing this object:

View keybase.md

Keybase proof

I hereby claim:

  • I am yegle on github.
  • I am yegle (https://keybase.io/yegle) on keybase.
  • I have a public key ASDxv0qT6AKb8q38_N-h7bdy-9s5_b1xiwzp54pi6irGxwo

To claim this, I am signing this object:

@yegle
yegle / looping-over-tuple-vs-list.md
Last active Jul 11, 2019
Looping over tuple is slightly faster than looping over list
View looping-over-tuple-vs-list.md

Looping over a tuple is faster than looping over a list in Python2

In Python2:

In [1]: def loop_list():    
   ...:     for i in [1, 2, 3]:                          
   ...:         pass        
   ...:                     

In [2]: def loop_tuple():   
@yegle
yegle / accounts.bean
Created Dec 1, 2015
include doesn't work with booking method
View accounts.bean
2014-09-03 open Assets:Vanguard:VXX VXX "NONE"
2014-09-03 open Expenses:Vanguard:Fee USD
2014-09-03 open Income:Hooli:Paycheck USD
@yegle
yegle / runme.sh
Last active Nov 30, 2015
document problem in beancount
View runme.sh
#!/usr/bin/env bash
echo "Because gist doesn't support directory"
dir=$(dirname "$0")
mkdir -p "$dir/stmts/Assets/US/BoA"
touch "$dir/stmts/Assets/US/BoA/2015-01-31.statement"
@yegle
yegle / mkdir.sh
Created Oct 7, 2015
Create a directory that cannot be deleted in OS X
View mkdir.sh
mkdir -p confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14B---/confdir-14
@yegle
yegle / list_reference_copy.py
Last active Aug 29, 2015
Create reference slice to a list in Python
View list_reference_copy.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
class MyList(list):
def __init__(self, raw_list, start=None, stop=None):
self.raw_list = raw_list
self.start = start or 0
self.stop = stop or len(raw_list)-1
@yegle
yegle / appengine_config.py
Last active Aug 29, 2015
Use VirtualEnv to manage dependencies on GAE project
View appengine_config.py
import os
from google.appengine.ext import vendor
"""
1. Create a virtualenv directory at the root of your project, name it "venv"
2. Install packages needed in your project
3. Freeze it and save the package list into requirements.txt file, add it to
version control
4. Exclude "venv" directory from version control
5. Save the content of this file as "appengine_config.py", and put it at the
@yegle
yegle / opt.py
Created Jul 3, 2014
USCIS OPT application status query
View opt.py
#!/usr/bin/env python
# vim: set fileencoding=utf-8 ts=4 sw=4 tw=79 :
from __future__ import (unicode_literals, absolute_import,
division, print_function)
import requests
from lxml import etree
from io import StringIO
You can’t perform that action at this time.