Skip to content

Instantly share code, notes, and snippets.

@uncreative
uncreative / post-checkout
Last active November 11, 2017 06:10 — forked from betorobson/post-checkout
git hook to run a command after `git pull` and `git checkout` if a specified file was change for example, package.json or bower.json
#!/usr/bin/env bash
changed_files="$(git diff-tree -r --name-only --no-commit-id $1 $2)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
}
post_checkout(){
make_reqs
@uncreative
uncreative / output.md
Created August 24, 2014 05:17
module with dictionary parameter and variables within dictionary

$ ansible-playbook playtest.yml -v

PLAY [127.0.0.1] **************************************************************

GATHERING FACTS *************************************************************** ok: [127.0.0.1]

TASK: [hard coded thingy] *****************************************************

ok: [127.0.0.1] => {"changed": false, "msg": "

  • stringy_var(<type 'unicode'>) : asdf(<type 'unicode'>) ||
@uncreative
uncreative / razer.py
Created March 13, 2013 01:04
avoiding razer synapse
import requests
for i in range(424,1424):
r = requests.get('http://www.razersupport.com/index.php?_m=downloads&_a=viewdownload&downloaditemid=%d' % i)
print i, r.text[r.text.find('<title>')+len('<title>'):r.text.find('</title>')]
# latest non synapse razer naga driver for mac: http://www.razersupport.com/index.php?_m=downloads&_a=viewdownload&downloaditemid=596&nav=0,40
@uncreative
uncreative / generateP4FilePerForThisHostPerClient.py
Created October 30, 2012 23:16
generate a .p4 file with P4CLIENT='correct-p4-client' and for every client for given user if that line does not already exist
#!/usr/bin/env python
# encoding: utf-8
"""
generate a .p4 file with P4CLIENT='correct-p4-client' for every client for given user if that line does not already exist
"""
__author__ = "Ayelet Goldin ([email protected])"
__version__ = "0.1"
__copyright__ = "Copyright (c) 2011-2011 Ayelet Goldin"
__license__ = "This script is in the public domain, free from copyrights or restrictions"
@uncreative
uncreative / SetSyntaxHighlight.py
Created August 2, 2012 20:06 — forked from fnando/SetSyntaxHighlight.py
Sublime Text 2 plugin for setting syntax highlighting automatically. Just put it on your Packages/User directory.
import sublime, sublime_plugin
import os
import re
from functools import partial
class SetSyntaxHighlightCommand(sublime_plugin.EventListener):
""" Sets the file grammar to whatever you want.
Author: Nando Vieira <http://nandovieira.com.br>
"""
@uncreative
uncreative / themecolorer.py
Created January 6, 2012 03:23
shows all the colors and styles specified in sublime theme
#!/usr/bin/env python
# encoding: utf-8
"""
%prog [options] path/to/sublime-text-themefile.tmTheme
shows all the colors and styles specified in sublime theme
Created by uncreative on 2012-01-05.
"""
@uncreative
uncreative / Info.plist
Created August 19, 2011 09:36
externally open a specific file in eclipse, and go to some line
<key>CFBundleIdentifier</key>
<string>com.unpeelingthemagic.AppleScript.Eclipse</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>OpenInEclipse</string>
<key>CFBundleURLSchemes</key>
<array>
<string>openineclipse</string>
@uncreative
uncreative / OpenInEclipse.applescript
Created July 22, 2011 19:23
externally open a specific file in eclipse, and go to some line
(*
-------- WHAT THIS DOES --------
Enables you to externally open a specific file in eclipse, and go to some line
that is, makes a link with href of
openineclipse://open?url=file:///absolute/path/tofile.ext&line=5
open absolute/path/tofile.ext in eclipse
and go to line 5