Skip to content

Instantly share code, notes, and snippets.

View neurobashing's full-sized avatar

Gregg Thomason neurobashing

View GitHub Profile
@wsargent
wsargent / worktree.sh
Created October 5, 2016 15:27
Git worktree script
export WORKDIR=$HOME/work
# Creates a working tree to check out a branch locally.
# This is useful when you have multiple branches on origin,
# and want to pull work work with them
function worktree() {
# We assume we're always under $WORKDIR somewhere.
# Go down the tree until we know what project we're in.
while [[ "$(dirname "$PWD")" != $WORKDIR ]] ; do
find "$PWD"/ -maxdepth 1 "$@"
@lost-theory
lost-theory / gist:3925738
Created October 21, 2012 04:29
different delimiters in jinja2 + flask
from flask import Flask, render_template_string, request
class CustomFlask(Flask):
jinja_options = Flask.jinja_options.copy()
jinja_options.update(dict(
block_start_string='<%',
block_end_string='%>',
variable_start_string='%%',
variable_end_string='%%',
comment_start_string='<#',
@itod
itod / remove_prefix.applescript
Last active November 21, 2016 03:56
AppleScript to remove a common prefix from the name of all files in a given folder.
set path_ to (get path to desktop as string) & "FOLDER NAME HERE"
set prefix_ to "PREFIX HERE"
tell application "Finder"
set dir_ to folder path_
set files_ to items of dir_ whose name of it starts with prefix_
set start_ to (get length of prefix_) + 1
repeat with file_ in files_
set oldname_ to name of file_
set end_ to length of oldname_
@rwilcox
rwilcox / run_selection_as_clipping.applescript
Created August 14, 2012 13:51
Run the current selection as a BBEdit clipping
tell application "BBEdit"
set theScript to selection as text
set clippingFileRef to (path to temporary items as string) & "clipping_as_selection"
--close access clippingFileRef
set fileref to open for access file clippingFileRef with write permission
set eof of fileref to 0 -- clear the file
write theScript to fileref
close access fileref
@gruber
gruber / Rename Active Document.scpt
Created August 8, 2012 03:51
Rename Active BBEdit Document
tell application "BBEdit"
activate
set old_name to name of text window 1
set dialog_result to display dialog "" default answer (old_name) ¬
buttons {"Cancel", "Rename"} default button 2 ¬
with icon note ¬
with title "Rename Active Document"
if button returned of dialog_result = "Rename" then
set new_name to text returned of dialog_result
set d to active document of text window 1
@jlieske
jlieske / bberrors.py
Last active May 11, 2016 06:24
Script to display compiler output messages in BBEdit browser window
#!/usr/bin/python
# -*- coding: utf-8 -*-
# BBErrors: Script to display compiler output messages in BBEdit browser window
# Copyright Jay Lieske Jr.
# 2 May 2016
import sys, re, os
import struct
from Foundation import NSAppleEventDescriptor
@earthgecko
earthgecko / bash.generate.random.alphanumeric.string.sh
Last active June 21, 2024 07:34
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1
@onecrayon
onecrayon / Postbox.plist
Created July 6, 2012 15:10
Postbox-style keybindings for MailMate (save in ~/Library/Application Support/MailMate/Resources/KeyBindings)
{
// Keybindings to emulate Postbox defaults in MailMate
// From: http://www.postbox-inc.com/support/postbox_shortcuts
// Created by Ian Beck <http://beckism.com>
"f" = "nextMessage:";
"b" = "previousMessage:";
"n" = "nextUnreadMessage:";
"p" = "previousUnreadMessage:";
"T" = "nextUnreadThread:";
@jeserkin
jeserkin / gist:1953801
Created March 1, 2012 22:50
Twitter Bootstrap Fluid-Sticky example. Modified martinbean example.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bootstrap, from Twitter</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link href="../assets/css/bootstrap.css" rel="stylesheet">
<style type="text/css">
@joeshaw
joeshaw / proxy_views.py
Created September 20, 2011 17:47
super-hacky flask proxy
# coding:utf-8
# Copyright 2011 litl, LLC. All Rights Reserved.
import httplib
import re
import urllib
import urlparse
from flask import Blueprint, request, Response, url_for
from werkzeug.datastructures import Headers