Skip to content

Instantly share code, notes, and snippets.

@trey
trey / happy_git_on_osx.md
Last active February 18, 2024 10:46
Creating a Happy Git Environment on OS X

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"

git config --global user.email "you@example.com"

@luismesas
luismesas / gist:3429720
Created August 22, 2012 21:51
NSString equation evaluator using NSExpression
NSString *equation = @"floor((19-10)/2)";
NSNumber *result = [NSExpression expressionWithFormat:equation];
NSLog(@"%@", result); // logs "4"
@senko
senko / screen-paste.sh
Created September 26, 2012 19:16
Grab a screenshot and paste it to the Web using pixbin.us
#!/bin/bash
#
# screen-paste - Paste a screenshot to the Web (using pixbin.us service)
#
# Written by Senko Rasic <senko.rasic@goodcode.io>
# Released into Public Domain. Use it as you like.
#
# The tool allows the user to select a portion of the screen, then copies it
# to pixbin.us, and stores the resulting URL in clipboard.
#
@aliou
aliou / parse_manifest.py
Last active January 22, 2019 15:11
Manifest.mbdb parsing for iOS 5+.
#!/usr/bin/env python
# From http://stackoverflow.com/questions/3085153/how-to-parse-the-manifest-mbdb-file-in-an-ios-4-0-itunes-backup
import sys
import hashlib
mbdx = {}
def getint(data, offset, intsize):
"""Retrieve an integer (big-endian) and new offset from the current offset"""
value = 0
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 17, 2024 02:53
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@tkellen
tkellen / gist:5116460
Created March 8, 2013 13:33
Remove a PDF Password w/ Ghost Script
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=frame-nopass.pdf -c .setpdfwrite -f frame.pdf
@dideler
dideler / example.md
Last active February 17, 2024 20:24
A python script for extracting email addresses from text files.You can pass it multiple files. It prints the email addresses to stdout, one address per line.For ease of use, remove the .py extension and place it in your $PATH (e.g. /usr/local/bin/) to run it like a built-in command.

The program below can take one or more plain text files as input. It works with python2 and python3.

Let's say we have two files that may contain email addresses:

  1. file_a.txt
foo bar
ok ideler.dennis@gmail.com sup
 hey...user+123@example.com,wyd
hello world!
@yyx990803
yyx990803 / nl.sh
Last active March 5, 2024 01:24
npm list only top level modules.
alias ng="npm list -g --depth=0 2>/dev/null"
alias nl="npm list --depth=0 2>/dev/null"
@guifromrio
guifromrio / compress-pdf-with-gs.md
Created August 30, 2013 14:39
Compress PDF files with ghostscript

This can reduce files to ~15% of their size (2.3M to 345K, in one case) with no obvious degradation of quality.

ghostscript -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

Other options for PDFSETTINGS:

  • /screen selects low-resolution output similar to the Acrobat Distiller "Screen Optimized" setting.
  • /ebook selects medium-resolution output similar to the Acrobat Distiller "eBook" setting.
  • /printer selects output similar to the Acrobat Distiller "Print Optimized" setting.
  • /prepress selects output similar to Acrobat Distiller "Prepress Optimized" setting.
@correia
correia / command-line-args.swift
Last active August 29, 2015 14:02
A verbose alternative to NSProcessInfo.processInfo().arguments
//
// command-line-args.swift
//
// Created by Jim Correia on 6/4/14.
// Copyright (c) 2014-2015 Jim Correia. All rights reserved.
//
print("PROG_NAME = \(Process.arguments[0])")
print("ARGC = \(Process.argc)")
print("ARGV = \(Process.arguments)")