Skip to content

Instantly share code, notes, and snippets.

@OniOni
OniOni / play.sh
Last active September 17, 2021 01:34
prjctz
#!/bin/bash
set -eo pipefail
DEFAULT_PROJECT_NAME="$(basename $(pwd))"
DEFAULT_BASEDIR="${HOME}/.prjctz"
function usage() {
echo "Usage: ${0} [options] image [--]"
echo "Mount current directory as an overlay and run in container."
@OniOni
OniOni / body_mapping_template.vtl
Created February 7, 2018 17:04
application/x-www-form-urlencoded / chalice mapping template
#set($allParams = $input.params())
{
"body-json" : "",
"base64-body": "$util.base64Encode($input.body)",
"params" : {
#foreach($type in $allParams.keySet())
#set($params = $allParams.get($type))
"$type" : {
#foreach($paramName in $params.keySet())
"$paramName" : "$util.escapeJavaScript($params.get($paramName))"
@OniOni
OniOni / Pipfile
Created September 22, 2017 21:20
pipenv failure :'(
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[dev-packages]
"flake8" = "==3.4.1"
pytest = "==3.2.0"
"pytest-cov" = "==2.5.1"
from multiprocessing import Process
import pika
exchange = 'test'
def mk_consumer(exchange, match, callback):
def inner():
connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))
@OniOni
OniOni / checking.diff
Last active May 31, 2017 21:57
JSON diff (old is breaking, new is reverted version that works)
diff /tmp/old.json /tmp/new.json
diff --git a/tmp/old.json b/tmp/new.json
index e78647a..1f44691 100644
--- a/tmp/old.json
+++ b/tmp/new.json
@@ -1,9 +1,9 @@
{
"meta": {
- "local_request_id": "98c590b8-b75c-460c-9ab7-5c0e79b6fc01",
+ "local_request_id": "0f083ba1-f784-4f26-940e-c70895d0b292",
@OniOni
OniOni / .emacs.el
Created May 30, 2017 23:32
[WIP] .emacs
;;; package --- Mats emacs conf
;;; Commentary:
;; none
;;; Code:
;; packages
(require 'package)
(add-to-list 'package-archives
@OniOni
OniOni / gevent.py
Last active February 8, 2017 05:49
import gevent
class Pool(object):
def __init__(self):
self.tasks = []
self._greenlets = []
def apply_async(self, func, *a, **k, callback=None):

Keybase proof

I hereby claim:

  • I am onioni on github.
  • I am msabourin (https://keybase.io/msabourin) on keybase.
  • I have a public key ASB_7LEfR_ALnJI_EuOHiF5EaJb-2kUnUskN9JI4PtY4dAo

To claim this, I am signing this object:

@OniOni
OniOni / 45minPopUp.diff
Created July 9, 2012 20:45
Code for having a popup encouraging free users to subscribe after minutes are over.
diff --git a/hostess/maitred/maitred/controllers/bugs.py b/hostess/maitred/maitred/controllers/bugs.py
index 39913e5..a456743 100644
--- a/hostess/maitred/maitred/controllers/bugs.py
+++ b/hostess/maitred/maitred/controllers/bugs.py
@@ -168,6 +168,7 @@ class BugsController(BaseController):
if c.loginname:
c.user = User.load(c.loginname)
c.subscribed = c.user.get_ancestor().get('SubscriptionActive')
+ c.minutes = c.user.get_minutes(type="ScoutCredits")
@OniOni
OniOni / WebDriverBase.diff
Created May 18, 2012 20:34
Diff for making php-webdriver work on saucelabs
diff --git a/PHPWebDriver/WebDriverBase.php b/PHPWebDriver/WebDriverBase.php
index 1f2bc78..c5f0708 100644
--- a/PHPWebDriver/WebDriverBase.php
+++ b/PHPWebDriver/WebDriverBase.php
@@ -144,6 +144,8 @@ abstract class PHPWebDriver_WebDriverBase {
curl_setopt($curl, CURLOPT_POST, true);
if ($params && is_array($params)) {
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($params));
+ } else {
+ curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-length: 0'));