Skip to content

Instantly share code, notes, and snippets.

View hameedullah's full-sized avatar
😄

Hameedullah Khan hameedullah

😄
View GitHub Profile
@hameedullah
hameedullah / dbg-cloud-init
Created February 25, 2018 11:17 — forked from ghaering/dbg-cloud-init
Re-run cloud init scripts on Ubuntu 12.04 (AWS)
#!/bin/sh
rm -rf /var/lib/cloud/sem/* /var/lib/cloud/instance /var/lib/cloud/instances/*
cloud-init start 2>&1 > /dev/null
cloud-init-cfg all final
@hameedullah
hameedullah / wp-admin-modal-dialog.php
Created April 24, 2017 21:35 — forked from anttiviljami/wp-admin-modal-dialog.php
WordPress admin modal dialog example
<?php
// enqueue these scripts and styles before admin_head
wp_enqueue_script( 'jquery-ui-dialog' ); // jquery and jquery-ui should be dependencies, didn't check though...
wp_enqueue_style( 'wp-jquery-ui-dialog' );
?>
<!-- The modal / dialog box, hidden somewhere near the footer -->
<div id="my-dialog" class="hidden" style="max-width:800px">
<h3>Dialog content</h3>
<p>This is some terribly exciting content inside this dialog. Don't you agree?</p>
@hameedullah
hameedullah / recover_source_code.md
Created March 12, 2017 13:05 — forked from simonw/recover_source_code.md
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@hameedullah
hameedullah / puppetdb-curl.sh
Created January 22, 2017 20:03 — forked from marshyski/puppetdb-curl.sh
Puppet DB Curl Examples
curl -sfG 'http://localhost:8080/v3/nodes' --data-urlencode 'query=["=", ["node", "active"], true]'
curl -sf 'http://localhost:8080/v3/facts'
curl -sf 'http://localhost:8080/v3/nodes'
curl -sfG 'http://localhost:8080/v3/nodes' --data-urlencode 'query=["=", ["fact", "kernel"], "Linux"]'
curl -sfG 'http://localhost:8080/v3/nodes' --data-urlencode 'query=["=", ["fa, "operatingsystem"], "windows"]'
@hameedullah
hameedullah / gist:5e85454f709da806589d453f39d3c83c
Created November 19, 2016 12:03
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
### Keybase proof
I hereby claim:
* I am hameedullah on github.
* I am hameedullah (https://keybase.io/hameedullah) on keybase.
* I have a public key ASBT8H6djymCvT7S0HlYgomuOokLKltwWaeZoQsdVVRFKwo
To claim this, I am signing this object:
@hameedullah
hameedullah / import.py
Last active May 25, 2016 15:34 — forked from kbl/import.py
importing tasks/lists from wunderlist into todoist
# -*- coding: utf8 -*-
import json
import urllib2
import urllib
import sys
import os
from argparse import ArgumentParser
from collections import defaultdict
@hameedullah
hameedullah / gist:1678cf57df75092236649aefbce4f908
Created April 26, 2016 10:43 — forked from panuta/gist:3075882
How to setup Django server with virtualenv on Ubuntu Server 12.04

Fix locale problem

Run the following command

$ update-locale LC_ALL="en_US.UTF-8"

If it failed, you will need to add the following to /var/lib/locales/supported.d/local file

en_US.UTF-8 UTF-8

@hameedullah
hameedullah / plugin-deploy.sh
Created November 16, 2012 08:17 — forked from markjaquith/plugin-deploy.sh
Plugin deploy script
#!/bin/bash
# args
MSG=${1-'deploy from git'}
BRANCH=${2-'trunk'}
# paths
SRC_DIR=$(git rev-parse --show-toplevel)
DIR_NAME=$(basename $SRC_DIR)
DEST_DIR=~/svn/wp-plugins/$DIR_NAME/$BRANCH
@hameedullah
hameedullah / factorial.py
Created July 10, 2012 05:22 — forked from ghoseb/factorial.py
The evolution of a Python Programmer
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal