Skip to content

Instantly share code, notes, and snippets.

Avatar
Coffee.

Aubrey Taylor aubricus

Coffee.
View GitHub Profile
View business-card-http-client.py
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 r.read():
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 business-card-http-client.py is 590 bytes long
@excenter
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
tanaikech / submit.md
Last active Oct 8, 2021
Downloading Shared Files on Google Drive Using Curl
View submit.md

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

CURL

filename="### filename ###"
fileid="### file ID ###"
curl -L -o ${filename} "https://drive.google.com/uc?export=download&id=${fileid}"
@joyrexus
joyrexus / README.md
Last active Oct 17, 2021
collapsible markdown
View README.md

collapsible markdown?

CLICK ME

yes, even hidden code blocks!

print("hello world!")
View letsencrypt_and_ngrok_on_osx.md

Prerequisites:

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
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
kosyfrances / heroku_database_copy.md
Last active Jul 14, 2021
To copy heroku database from one app to another and from local to heroku
View heroku_database_copy.md

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 https://devcenter.heroku.com/articles/heroku-postgres-backups 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
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
vbalazs / howto.md
Last active Aug 16, 2017
Github fetch PRs
View howto.md

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 = https://github.com/neovim/neovim.git
  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