Skip to content

Instantly share code, notes, and snippets.

View valsteen's full-sized avatar

Vincent Alsteen valsteen

View GitHub Profile
@arthuralvim
arthuralvim / queue_threading.py
Created February 21, 2019 17:18
Example of python queues and multithreading.
import queue
import threading
num_worker_threads = 1
def do_work(item):
print(item)
@dehora
dehora / debug_logging_ddb_local.sh
Last active March 18, 2023 17:42
debug logging for dynamodb local
cd ~/projects/bin/dynamodb
cat > log4j2.xml <<- XML
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="fatal">
<Appenders>
<Console name="STDOUT" target="SYSTEM_OUT">
<PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
</Console>
</Appenders>
@gsomoza
gsomoza / .bashrc
Created January 17, 2013 16:50
SSH Agent in Windows (Git Bash / MinGW)
#!bash.exe
export SSH_AUTH_SOCK=/tmp/.ssh-socket
echo ;
echo Starting connection with ssh-agent...
ssh-add -l 2>&1 >/dev/null
if [ $? = 2 ]; then
rm -f /tmp/.ssh-script /tmp/.ssh-agent-pid /tmp/.ssh-socket
# Exit status 2 means couldn't connect to ssh-agent; start one now
echo Creating new ssh-agent...
ssh-agent -a $SSH_AUTH_SOCK > /tmp/.ssh-script
>>> e = codecs.lookup('zlib').incrementalencoder()
>>> e.encode('foo')
'x\x9c'
>>> e.encode('bar')
''
>>> e.encode('baz')
''
>>> e.encode('', final=True)
'K\xcb\xcfOJ,JJ\xac\x02\x00\x12{\x03\xb7'
@swanson
swanson / unblur_quora.user.js
Created July 30, 2012 17:11
Chrome user script to unblur Quora answers without signing up
// ==UserScript==
// @match http://*.quora.com/*
// ==/UserScript==
// a function that loads jQuery and calls a callback function when jQuery has finished loading
function addJQuery(callback) {
var script = document.createElement("script");
script.setAttribute("src", "//code.jquery.com/jquery-latest.min.js");
script.addEventListener('load', function() {
var script = document.createElement("script");
@mariozig
mariozig / perm-solution.conf
Created July 8, 2012 05:59
perm solution
# Edits to /etc/sysctl.conf
kern.sysv.shmall=65536
kern.sysv.shmmax=16777216
@timoxley
timoxley / index.html
Created July 6, 2012 11:53
simple example using ember router and connect outlet
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Ember.js Router Example</title>
<meta name="description" content="Example of a basic Ember.js application with a Router" />
<meta name="author" content="http://codebrief.com" />
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
@marianoguerra
marianoguerra / table2rst.py
Created August 10, 2011 16:14
csv table 2 rst
'''read a csv file representing a table and write a restructured text simple
table'''
import sys
import csv
def get_out(out=None):
'''
return a file like object from different kinds of values
None: returns stdout
string: returns open(path)
@vicalejuri
vicalejuri / django-crossdomainxhr-middleware.py
Created June 5, 2010 17:47
Middlware to allow's your django server to respond appropriately to cross domain XHR (postMessage html5 API).
import re
from django.utils.text import compress_string
from django.utils.cache import patch_vary_headers
from django import http
try:
import settings
XS_SHARING_ALLOWED_ORIGINS = settings.XS_SHARING_ALLOWED_ORIGINS