Skip to content

Instantly share code, notes, and snippets.


Aubrey Taylor aubricus

View GitHub Profile
import asyncio as A,urllib.parse as U,re;B,C,I,S=b"",b"\r\n",int,lambda*A:re.match(*A,24).groups()
async def request(m,u,h,b=B):
s,n,a,_,q,_=z=U.urlparse(u);T,E,d,N=s!=b"http",0,B,z.hostname;r,w=await A.open_connection(N,I(z.port or 80+363*T),ssl=T,server_hostname=[None,h][T]);w.write(m+b" "+(a or b"/")+[b"?"+q,B][q==B]+b" HTTP/1.0"+C+C.join([b"%b:%b"%W for W in h]+[B,b]));await w.drain()
while c:=await
if C*2in(d:=d+c)*(E==0):E,d=d.split(C*2,1);t,o=S(rb"HTTP/.+? (\d+).*?%b(.*)"%C,E);o=[S(rb"([^\s]+):\s*(.+?)\s*$",x)for x in o.split(C)]
await w.aclose();return I(t),o,d
# An HTTP library that fits on a business card
# Currently is 590 bytes long
excenter / rune.bash
Created Nov 30, 2018
Mojave pyenv update
View rune.bash
export VERSION="3.7.1"
xcode-select --install
brew update
brew upgrade
brew install zlib
brew reinstall zlib
export LDFLAGS="-L/usr/local/opt/zlib/lib"
export CPPFLAGS="-I/usr/local/opt/zlib/include"
pyenv install $VERSION
pyenv global $VERSION
tanaikech /
Last active Oct 8, 2021
Downloading Shared Files on Google Drive Using Curl

Downloading Shared Files on Google Drive Using Curl

When the shared files on Google Drive is downloaded, it is necessary to change the download method by the file size. The boundary of file size when the method is changed is about 40MB.

File size < 40MB


filename="### filename ###"
fileid="### file ID ###"
curl -L -o ${filename} "${fileid}"
joyrexus /
Last active Oct 17, 2021
collapsible markdown

collapsible markdown?


yes, even hidden code blocks!

print("hello world!")


You'll need:

  1. A paid ngrok account
  2. A reserved domain on ngrok, e.g. the FQDN you're generating certs for
  3. A registed domain and access to change DNS records

How to

  1. Install certbot and ngrok
  • brew cask install certbot ngrok
aubricus / view.js
Last active May 2, 2016
Micro-visual-state-transition mechanic
View view.js
define(function (require, exports, module) {
var _ = require("underscore");
var $ = require("jquery");
var backbone = require("backbone");
var marionette = require("marionette");
var UploadImagesModalView = marionette.LayoutView.extend({
validTansitionStates: ["initial", "activity", "valid", "invalid"],
kosyfrances /
Last active Jul 14, 2021
To copy heroku database from one app to another and from local to heroku

To copy database from one heroku app to another -

heroku pg:backups capture [database_name]
heroku pg:backups restore $(heroku pg:backups public-url --app source_app) DATABASE_URL --app target_app

You can refer to for more information.

To copy database from local to heroku - Dump your local database in compressed format using the open source pg_dump tool: PGPASSWORD=mypassword pg_dump -Fc --no-acl --no-owner -h localhost -U myuser mydb > mydb.dump where myuser is your database username and mydb is the database name.

View python_decorators.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Jaza / Private-pypi-howto
Last active Oct 14, 2021
Guide for how to create a (minimal) private PyPI repo, just using Apache with directory autoindex, and pip with an extra index URL.
vbalazs /
Last active Aug 16, 2017
Github fetch PRs

GitHub provides a special pulls remote "namespace" on the upstream repo, so you can add it as a fetch pattern to your .git/config like so:

[remote "upstream"]
  url =
  fetch = +refs/heads/*:refs/remotes/upstream/*
  fetch = +refs/pull/*/head:refs/pull/upstream/*

Then when you git fetch --all, you will have ALL pull requests available in your local repo in the local pull/ namespace. To check out PR #42:

git checkout -b foo refs/pull/upstream/42