Skip to content

Instantly share code, notes, and snippets.

View hugochinchilla's full-sized avatar
🤖
I'm not a robot

Hugo Chinchilla Carbonell hugochinchilla

🤖
I'm not a robot
View GitHub Profile
@hugochinchilla
hugochinchilla / alchemy_expression_wrapper.py
Created March 24, 2017 19:54
SqlAlchemy expression wrapper
from sqlalchemy.sql.elements import BinaryExpression
class C(object):
"""
This class is intend to be used in tests with unittest.mock.call
This class allows to wrap an sqlalchemy BinaryExpression in a way
you can compare a BinaryExpression agains a Wrapped BinaryExpression
to check if they are equivalent, as comparing them directly results
@hugochinchilla
hugochinchilla / model.py
Created March 24, 2017 18:38
sqlalchemy model base class with object manager
from sqlalchemy.ext.declarative import DeclarativeMeta, declarative_base
# it's up to you how your session object is created
from .session import session as default_session
class Manager(object):
YIELD_CURSOR_SIZE = 100
def __init__(self, model, session=None):
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React"),require("ReactDOM")):"function"==typeof define&&define.amd?define(["React","ReactDOM"],t):"object"==typeof exports?exports["material-ui"]=t(require("React"),require("ReactDOM")):e["material-ui"]=t(e.React,e.ReactDOM)}(this,function(e,t){return function(e){function t(n){if(o[n])return o[n].exports;var r=o[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var o={};return t.m=e,t.c=o,t.i=function(e){return e},t.d=function(e,o,n){t.o(e,o)||Object.defineProperty(e,o,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var o=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(o,"a",o),o},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=376)}([function(t,o){t.exports=e},function(e,t){e.exports=function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n]
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React"),require("ReactDOM")):"function"==typeof define&&define.amd?define(["React","ReactDOM"],t):"object"==typeof exports?exports.jumpsuit=t(require("React"),require("ReactDOM")):e.jumpsuit=t(e.React,e.ReactDOM)}(this,function(e,t){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=125)}([function(t,n){t.exports=e},function(e,t,n){"use strict";var r=function(e,t,n,r,o,i,a,u){if(!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for
#!/bin/sh
set -e
#
# This script is meant for quick & easy install via:
# 'curl -sSL https://get.docker.com/ | sh'
# or:
# 'wget -qO- https://get.docker.com/ | sh'
#
# For test builds (ie. release candidates):
# 'curl -fsSL https://test.docker.com/ | sh'
@hugochinchilla
hugochinchilla / slack_munin.sh
Last active July 7, 2023 14:53 — forked from anarchivist/slack_munin.sh
Slack notification script for Munin
#!/bin/bash
# Slack notification script for Munin
# Mark Matienzo (@anarchivist)
#
# To use:
# 1) Create a new incoming webhook for Slack
# 2) Edit the configuration variables that start with "SLACK_" below
# 3) Add the following to your munin configuration:
#
@hugochinchilla
hugochinchilla / sflphone-callto.py
Created November 25, 2015 10:09
SFLphone handler for "callto" or "tel" urls, uses the first enabled SIP account to place the call.
#!/usr/bin/env python
from os.path import expanduser
from os import popen
from yaml import load as load_yaml
from random import randint
from sys import argv
import re
import sys
@hugochinchilla
hugochinchilla / README.md
Last active August 29, 2015 14:27 — forked from andris9/README.md
Extremely simple HTTP proxy for changing Host: header Useful when proxying requests to virtual hosts that require Host: header to be set.

Setup reverse tunnel

Run the following in your client machine

ssh -R EXPOSED_PORT:localhost:SERVICE_PORT USER@HOST

Where

  • EXPOSED_PORT is the port exposed to the internet in the proxy server
  • SERVICE_PORT is the port your application is listening in your machine
@hugochinchilla
hugochinchilla / PHP-lint.sublime-build
Created June 25, 2015 11:09
Sublime PHP builder (not really)
# ~/.config/sublime-text-3/Packages/User/PHP-lint.sublime-build
{
"shell": true,
"cmd": ["php -l $file && php-cs-fixer --config-file=/path/to/csfixer.conf fix $file"]
}
@hugochinchilla
hugochinchilla / Exec.php
Last active December 23, 2015 08:49 — forked from vglebov/Exec.php
<?php
class Exec {
protected $commandLine;
protected $resultCode = 0;
protected $stdout;
protected $stderr;
public static function withCommandLine($commandLine){