Skip to content

Instantly share code, notes, and snippets.

View jontsai's full-sized avatar
😎
h4x0ring

Jonathan Tsai jontsai

😎
h4x0ring
View GitHub Profile
@jontsai
jontsai / django_wsgi_utf8_handler.py
Created February 18, 2020 04:51
Subclasses and extends WSGIRequest and WSGIHandler from django.core.handlers.wsgi
# Python Standard Library Imports
import re
# Django Imports
from django.core.handlers import base
from django.core.handlers.wsgi import LimitedStream
from django.core.handlers.wsgi import WSGIHandler
from django.core.handlers.wsgi import WSGIRequest
from django.core.handlers.wsgi import get_script_name
from django.utils.encoding import repercent_broken_unicode
#!/bin/sh
# Fill in with your own values
REMOTE_USER=your_username
REMOTE_HOST=dev.acme.com
# Make sure to end in a slash
LOCAL_DIR="$HOME/path/to/local/dev/"
REMOTE_DIR="/path/to/remote/dev/"
echo "Checking for fswatch installation"
#!/bin/sh
# Source: https://help.github.com/en/articles/changing-author-info
git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"

Keybase proof

I hereby claim:

  • I am jontsai on github.
  • I am jontsai (https://keybase.io/jontsai) on keybase.
  • I have a public key ASDmxSpRRSFT5vSN-pL7vjineIuQHhDQZKkXDBIwj_v-_Ao

To claim this, I am signing this object:

#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@jontsai
jontsai / gist:89453c1d85dd8f9767cd61e17bc13800
Created October 1, 2017 10:21 — forked from brettstimmerman/gist:943498
Load a YUI Gallery module locally for testing.
/**
* Load a YUI Gallery module locally for testing.
*
* Assumes you've built your module with ant and have a local copy of the
* yui3-gallery repo.
*
* This will override Loader's Gallery configuration. Existing Gallery modules
* will load locally, and your new module should load locally as well.
*
* Props to Caridy for helping piece this together.
@jontsai
jontsai / ThreadPoolExample.scala
Created July 18, 2017 00:09
Scala thread pool example
import java.util.concurrent.Executors
val pool = java.util.concurrent.Executors.newFixedThreadPool(2)
1 to 10 foreach { x =>
pool.execute(
new Runnable {
def run {
Thread.sleep(2000)
println("n: %s, thread: %s".format(x, Thread.currentThread.getId))
@jontsai
jontsai / ThreadPoolExample.scala
Created July 18, 2017 00:09
Scala thread pool example
import java.util.concurrent.Executors
val pool = java.util.concurrent.Executors.newFixedThreadPool(2)
1 to 10 foreach { x =>
pool.execute(
new Runnable {
def run {
Thread.sleep(2000)
println("n: %s, thread: %s".format(x, Thread.currentThread.getId))
@jontsai
jontsai / crxmake.sh
Last active June 17, 2017 11:38
crxmake.sh - Pack a Chromium extension directory into crx format
#!/bin/bash -e
#
# Purpose: Pack a Chromium extension directory into crx format
# Source: https://developer.chrome.com/extensions/crx
if test $# -ne 2; then
echo "Usage: crxmake.sh <extension dir> <pem path>"
exit 1
fi
@jontsai
jontsai / get_agent_versions.py
Created May 25, 2017 23:04
Print out a list of outdated Datadog agents
import pprint
import re
import requests
DATADOG_OPTIONS = {
'api_key': 'REDACTED',
'app_key' : 'REDACTED',
}
LATEST_DATADOG_AGENT_VERSION = '5.13.2'