View gist:8971487
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
runas /netonly /user:administrator "%windir%\notepad.exe %windir%\system32\drivers\etc\hosts" |
View charm-local.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Override "log" and "config" methods from charmhelpers | |
# so that they work outside of a juju context | |
# from charmhelpers.core.hookenv import config | |
# from charmhelpers.core.host import log | |
import yaml | |
def log(message): | |
print message |
View http_errors.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import errno | |
def error_response(error, filename): | |
status = 500 # Default to "server error" | |
if hasattr(error, 'errno'): | |
if error.errno in [errno.EPERM, errno.EACCES]: | |
status = 403 # Forbidden | |
if error.errno in [errno.ENOENT, errno.ENXIO]: |
View swift-container-url.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# Credit to Chris Stanford for this | |
import os | |
import sys | |
from swiftclient import client | |
userName = os.getenv('OS_USERNAME') |
View files-modified-yesterday.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find ~ -type f -mtime -1 -exec ls -lah {} \; | egrep -v '([.](cache|config|git|local|bash|gnome|xsession|steam|gconf|lesshst|sass-cache)|_site)' |
View git-amend-at-commit.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
: <<'HELP' | |
Amend at commit | |
=== | |
If you stage some files to be committed with git | |
this script will then cycle back to a specific commit, | |
apply those changes to that commit. |
View getDescendantsByClassName.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This is effectively an implementation of | |
* `element.getElementsByClassName` | |
* (see: https://developer.mozilla.org/en-US/docs/Web/API/Element.getElementsByClassName) | |
* | |
* You should probably just use the built-in method. | |
* | |
* This is therefore a partial replacement for the jQuery find() method | |
* in pure JavaScript. | |
* |
View gist:e418c5ba2f4f7dcf027a
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd ~/.bazaar/plugins | |
bzr branch lp:bzr-fastimport fastimport |
View gist:264e08d726c3ecacf102
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git init # Initialise a new git repo | |
bzr fast-export --plain . | git fast-import # Import Bazaar history into Git |
View gist:9cc2e6b7deb60a434f67
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git log # Check your revision history is in Git |
OlderNewer