Skip to content

Instantly share code, notes, and snippets.

View drawcode's full-sized avatar
😎
Shipping product

Ryan Christensen drawcode

😎
Shipping product
View GitHub Profile
@drawcode
drawcode / README.md
Created February 5, 2014 09:03 — forked from oodavid/README.md

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/
@drawcode
drawcode / multiplealias.bash
Created February 8, 2014 21:48
multiplealias.bash
$ ssh-keygen -f ~/.ssh/personalid -C "personalid"
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/manthony/.ssh/personalid.
Your public key has been saved in /Users/manthony/.ssh/personalid.pub.
The key fingerprint is:
7a:9c:b2:9c:8e:4e:f4:af:de:70:77:b9:52:fd:44:97 personalid
The key's randomart image is:
+--[ RSA 2048]----+
Method one - PSEXEC
An easy way to get a CMD prompt as SYSTEM is to grab PSEXEC from Microsoft Sysinternals:
1. Download PSEXEC and unzip to some folder.
2. Open an elevated CMD prompt as an administrator.
3. Navigate to the folder where you unzipped PSEXEC.EXE
@drawcode
drawcode / jsontopyobject.py
Last active August 29, 2015 13:56
JSON to Python object
# using namedtuple and object_hook:
import json
from collections import namedtuple
data = '{"name": "John Smith", "hometown": {"name": "New York", "id": 123}}'
# Parse JSON into an object with attributes corresponding to dict keys.
x = json.loads(data, object_hook=lambda d: namedtuple('X', d.keys())(*d.values()))
print x.name, x.hometown.name, x.hometown.id
@drawcode
drawcode / CompressUtil.cs
Created February 12, 2014 01:32
Compression utility for compressing strings with ToCompressed and ToDecompressed extensions.
using System;
using System.IO;
using System.IO.Compression;
using System.Text;
public static class CompressUtil {
public static string ToCompressed(this string val) {
if (!IsStringCompressed(val)) {
return CompressString(val);
@drawcode
drawcode / apache-node.conf
Last active August 29, 2015 13:56 — forked from davybrion/s1.xml
When you are stuck with apache bound to a port on a server and need a node.js proxy.
<VirtualHost 109.74.199.47:80>
ServerAdmin admin@myserver.com
ServerName myserver.com
ServerAlias www.myserver.com
ProxyRequests off
<Proxy *>
Order deny,allow
Allow from all
@drawcode
drawcode / logo.html
Last active August 29, 2015 13:56
svg animation
<div id="logo"><a href="/" class="at"><svg width="149" height="85"><g transform="translate(50,39)"><rect class="logo-b" x="-38" y="-14" width="6" height="6"></rect><rect class="logo-b" x="-38" y="-7" width="6" height="6"></rect><rect class="logo-b" x="-38" y="0" width="6" height="6"></rect><rect class="logo-b" x="-38" y="7" width="6" height="6"></rect><rect class="logo-b" x="-38" y="14" width="6" height="6"></rect><rect class="logo-b" x="-31" y="14" width="6" height="6"></rect><rect class="logo-b" x="-24" y="14" width="6" height="6"></rect><rect class="logo-b" x="-24" y="7" width="6" height="6"></rect><rect class="logo-b" x="-24" y="0" width="6" height="6"></rect><rect class="logo-b" x="-31" y="0" width="6" height="6"></rect><rect class="logo-u" x="0" y="0" width="6" height="6"></rect><rect class="logo-u" x="-14" y="0" width="6" height="6"></rect><rect class="logo-u" x="0" y="7" width="6" height="6"></rect><rect class="logo-u" x="0" y="14" width="6" height="6"></rect><rect class="logo-u" x="-14" y="7" width="
@drawcode
drawcode / gist:9316800
Created March 3, 2014 01:09
nginx s3 proxy
location /p/ {
try_files $uri @s3;
}
location @s3{
proxy_pass http://my_bucket.s3.amazonaws.com;
}
##
## This nginx.conf servers as the main config file for webflow reverse proxy
##
## RCS:
## https://gist.github.com/sansmischevia/5617402
##
## Hardening tips:
## http://www.cyberciti.biz/tips/linux-unix-bsd-nginx-webserver-security.html
##
@drawcode
drawcode / ajax.js
Created March 28, 2014 04:37
plugin less ajax, old skool
function ajax (url, parms) {
parms = parms || {};
var req = new XMLHttpRequest(),
post = parms.post || null,
callback = parms.callback || null,
timeout = parms.timeout || null;
req.onreadystatechange = function () {
if ( req.readyState != 4 ) return;