Skip to content

Instantly share code, notes, and snippets.

@metashock
metashock / pytest_mock_api.py
Last active January 20, 2016 22:55
How to mock an external API with pytest_mock
class Api():
def persons(self):
return ['hek2mgl', 'lgm2keh']
class App(Api):
def hello_messages(self):
msg = []
@metashock
metashock / get_request_uri
Last active August 29, 2015 14:06
PHP - Get Request Uri
function get_request_uri() {
$url = 'http';
if(isset($_SERVER['https']) && $_SERVER['https'] == 'on') {
$url .= 's';
}
$url .= '://';
$url .= $_SERVER['SERVER_NAME'];
@metashock
metashock / mkalien.sh
Created August 14, 2014 14:58
Make alien out of linux binary
#!/bin/bash
if [ $# != 2 ] ; then
echo "usage $0 PATH_TO_BINARY TARGET_FOLDER"
exit 1
fi
PATH_TO_BINARY="$1"
TARGET_FOLDER="$2"
@metashock
metashock / gist:937912
Created April 22, 2011 23:12
hello world
hello world