Skip to content

Instantly share code, notes, and snippets.

@sdcxyz
sdcxyz / server.py
Created May 7, 2018 04:17 — forked from mdonkers/server.py
Simple Python 2.7 HTTP server for logging all GET and POST requests
#!/usr/bin/env python
"""
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
import logging
class S(BaseHTTPRequestHandler):
@sdcxyz
sdcxyz / README.md
Created September 14, 2017 08:51 — forked from oodavid/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@sdcxyz
sdcxyz / hammer-url.js
Created April 8, 2016 11:01 — forked from acdha/hammer-url.js
Simple phantomjs script to reload a webpage as quickly as possible: `phantomjs --disk-cache=yes hammer-url.js http://127.0.0.1/path-to-page 500`
/* global phantom, WebPage, require, console */
// jshint strict:false
var system = require('system');
if (system.args.length > 3 || system.args.length < 2) {
console.log('Usage:', system.args[0], 'URL [count=20]');
phantom.exit();
}
@sdcxyz
sdcxyz / util.php
Last active August 29, 2015 14:14 — forked from aeurielesn/util.php
<?php
#source: http://stackoverflow.com/questions/2934563/how-to-decode-unicode-escape-sequences-like-u00ed-to-proper-utf-8-encoded-char
function replace_unicode_escape_sequence($match) {
return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE');
}
function unicode_decode($str) {
return preg_replace_callback('/\\\\u([0-9a-f]{4})/i', 'replace_unicode_escape_sequence', $str);
}