Skip to content

Instantly share code, notes, and snippets.

@JamoCA
JamoCA / ColumnToSQLList.ahk
Created July 26, 2013 15:30
AutoHotKey script to convert clipboard columnar data (from Excel or text file) to SQL-compatible comma-delimited list (adds single quotes if data consists of non-numeric values) (Windows+C)
#c:: ;Window+C Convert Columnar Data to SQL-Compatible List
StringReplace,clipboard,clipboard,`n,`,,All
StringReplace,clipboard,clipboard,`r,,All
StringGetPos, pos, clipboard, ID`, ; remove "ID" if first item in the list (Access).
if pos = 0
StringRight, clipboard, clipboard, StrLen(clipboard)-3
testString = %clipboard%
StringReplace,testString,testString,`,,,All
testString := testString * 1
if (testString is integer) {
@JamoCA
JamoCA / CleanCSS.ahk
Created July 26, 2013 15:31
AutoHotKey script to minimizes spacing in CSS and convert common color codes to shorter values. (CTRL+ALT+S)
^!s:: ; CTRL+ALT+S Clean CSS (reduce whitespace + shorten hex color values)
WinGetActiveTitle, Title
IfInString, Title, HomeSite
{
StringReplace,clipboard,clipboard,;`r`n,;%A_Space%,,All
StringReplace,clipboard,clipboard,%A_Space%},},,All
StringReplace,clipboard,clipboard,{`r`n,{,,All
StringReplace,clipboard,clipboard,`r`n{,%A_Space%{,,All
StringReplace,clipboard,clipboard,{%A_Space%,{,,All
StringReplace,clipboard,clipboard,:%A_Space%,:,,All
@JamoCA
JamoCA / DedupeUniqueColumn.ahk
Created July 26, 2013 15:39
AutoHotKey script to sort and removed duplicate values from a column of data (ie, column of values from a spreadsheet). (CTRL+SHIFT+U)
SANITIZE: ;sanitize characters (optional, see below)
AutoTrim,Off
StringCaseSense,On
StringReplace,string,string,chr(160),A_Space,All ;Non-breaking space
StringReplace,string,string,–,-,All ;emdash
StringReplace,string,string,´,',All
StringReplace,string,string,’,',All
StringReplace,string,string,©,(C),All
StringReplace,string,string,“,",All ;left quote
StringReplace,string,string,”,",All ;right quote
@JamoCA
JamoCA / ExcelFindNext.ahk
Created July 26, 2013 15:41
AutoHotKey script to remap Excel's SHIFT+F4 "Find Next" to simply F3 (same as defunct Adobe HomeSite+, the IDE I'm still using.)
#IfWinActive ahk_class XLMAIN
F3::+F4
#IfWinActive
@aras-p
aras-p / preprocessor_fun.h
Last active May 3, 2025 13:47
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@mwhite
mwhite / git-aliases.md
Last active May 1, 2025 16:05
The Ultimate Git Alias Setup

The Ultimate Git Alias Setup

If you use git on the command-line, you'll eventually find yourself wanting aliases for your most commonly-used commands. It's incredibly useful to be able to explore your repos with only a few keystrokes that eventually get hardcoded into muscle memory.

Some people don't add aliases because they don't want to have to adjust to not having them on a remote server. Personally, I find that having aliases doesn't mean I that forget the underlying commands, and aliases provide such a massive improvement to my workflow that it would be crazy not to have them.

The simplest way to add an alias for a specific git command is to use a standard bash alias.

# .bashrc
@frank4565
frank4565 / MultipleLineOmniFocus.py
Last active March 25, 2018 08:15
Send Multiple Tasks to OmniFocus at Once with Drafts and Pythonista or one task with Launch Center Pro. Supported Chinese. (Other Unicode characters should also work.)
# -*- coding: utf-8 -*-
# More information: Send Multiple Tasks to OmniFocus at Once with Drafts and Pythonista or one task with Launch Center Pro. Supported Chinese. (Other Unicode characters should also work.)
# Script name: MultiLineOmniFocus
# Drafts "URL Action": pythonista://MultiLineOmniFocus?action=run&argv=[[draft]]%0Adrafts
# Launch Center Pro: pythonista://MultiLineOmniFocus?action=run&args={{[prompt:New Item]}}%0Alaunchpro
# or Install from http://launchcenterpro.com/tdp7fb
# Modified from email script by OMZ: ImageMail
# Modified from script by @Thinkbond from Zhihu.com (http://www.zhihu.com/question/20888606/answer/17093178)
# Inspired by http://n8henrie.com/2013/03/send-multiple-tasks-to-omnifocus-at-once-with-drafts-and-pythonista
@ger-
ger- / chaining-lessn-tweetbot.py
Created December 4, 2013 20:08
chaining-lessn-tweetbot: Clicking this (javascript:window.location='pythonista://chaining-lessn-tweetbot?action=run&argv='+encodeURIComponent(document.location.href);) bookmarklet will launch this pythonista script to grab the webpage url and use Lessn to shorten it and then launch compose dialog of Tweetbot with the shortened url. Note: add you…
import webbrowser
import clipboard
import urllib
import sys
import console
import urllib2
l = sys.argv
link=l[1]
lessn='http://'yourdomain'/'x'/-/?api='API key'&url='
link=urllib.quote(link,safe='')
@mlgill
mlgill / DropboxSync.py
Last active February 12, 2019 18:11 — forked from wrenoud/DropboxSync.py
DropboxSync: iOS (Pythonista), synchronizes all files to/from Dropbox directory
import os, sys, pickle, console, re
sys.path += ['lib']
import dropboxsetup
# dropbox_sync
# by Michelle L. Gill, [email protected]
# requires my dropboxsetup module (https://gist.github.com/8311046)
# Change log
@gruber
gruber / Liberal Regex Pattern for Web URLs
Last active April 22, 2025 16:56
Liberal, Accurate Regex Pattern for Matching Web URLs
The regex patterns in this gist are intended only to match web URLs -- http,
https, and naked domains like "example.com". For a pattern that attempts to
match all URLs, regardless of protocol, see: https://gist.github.com/gruber/249502
# Single-line version:
(?i)\b((?:https?:(?:/{1,3}|[a-z0-9%])|[a-z0-9.\-]+[.](?:com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|s