Skip to content

Instantly share code, notes, and snippets.

@ssp
ssp / nibtoxib.sh
Created December 11, 2009 11:57
nibtoxib
#! /bin/sh
find . -name "*.nib" -type d | awk '{sub(/.nib/,"");print}' | xargs -I % ibtool --write %.xib --upgrade %.nib
@ssp
ssp / xibtonib.sh
Created December 11, 2009 11:58
xibtonib
#! /bin/sh
find . -name "*.xib" -type f | awk '{sub(/.xib/,"");print}' | xargs -I % ibtool --compile %.nib %.xib
@mathiasbynens
mathiasbynens / appify
Created November 12, 2010 13:46 — forked from subtleGradient/appify
appify — create the simplest possible Mac app from a shell script
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF
appify v3.0.1 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a shell script.
Appify takes a shell script as its first argument:
`basename "$0"` my-script.sh
@deanlxvii
deanlxvii / hex_byte_conversion.py
Created October 14, 2011 17:38
Hex Byte Conversion
"""
HexByteConversion
Convert a byte string to it's hex representation for output or visa versa.
ByteToHex converts byte string "\xFF\xFE\x00\x01" to the string "FF FE 00 01"
HexToByte converts string "FF FE 00 01" to the byte string "\xFF\xFE\x00\x01"
"""
#-------------------------------------------------------------------------------
@eklipse2k8
eklipse2k8 / ios_sdk
Created January 6, 2012 21:41
Helps for developing scripts that need to know the actual SDK path.
#!/usr/bin/python
import plistlib
import os
import commands
import argparse
DEVELOPER_DIR = commands.getoutput('/usr/bin/xcode-select -print-path')
PLATFORMS_DIRECTORY = os.path.join(DEVELOPER_DIR, "Platforms")
IPHONE_PLATFORM = "iPhoneOS.platform"
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@erbmicha
erbmicha / compile_xibs
Created May 27, 2012 04:08
Compile XIB files into NIB files for RubyMotion projects
#!/bin/bash
XIBS="*.xib
app/*.xib
interfaces/*.xib
resources/*.xib"
for i in $XIBS
do
echo "Compiling `basename $i`..."
ibtool --compile resources/`basename -s .xib $i`.nib $i
@lhw
lhw / WhatsAppDecrypter.java
Created April 27, 2013 19:56
WhatsApp msgstore decrypter
public class Main {
public static void main(String[] args) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, IOException {
final SecretKeySpec keySpec = new SecretKeySpec("4j#e*F9+Ms%|g1~5.3rH!we,".getBytes(), "AES");
final Cipher cipher = Cipher.getInstance("AES/ECB/NoPadding");
cipher.init(Cipher.DECRYPT_MODE, keySpec);
FileUtils.writeByteArrayToFile(new File("msgstore.db"), cipher.doFinal(FileUtils.readFileToByteArray(new File("msgstore.db.crypt"))));
}
}
@trinitronx
trinitronx / xcode-cli-tools.sh
Last active January 18, 2024 05:20
Script to download & install XCode Command Line tools on OSX 10.7 or 10.8. Lifted from jedi4ever/veewee template.
#!/bin/sh
# 2021-12-09:
# This script is no longer supported!
# Apple broke all direct downloads without logging with an Apple ID first.
# The number of hoops that a script would need to jump through to login,
# store cookies, and download is prohibitive.
# Now we all must manually download and mirror the files for this to work at all :'-(
OSX_VERS=$(sw_vers -productVersion | awk -F "." '{print $2}')

How not to rm yourself

Copied from https://github.com/sindresorhus/guides/blob/master/how-not-to-rm-yourself.md

The rm command is inherently dangerous and should not be used directly. It can at worst let you accidentally remove everything. Here's how you can protect you from yourself.

Use trash

The trash command-line tool will move stuff to the trash instead of permanently deleting it. You should not alias rm to trash as it will break external scripts relaying on the behavior of rm. Instead use it directly: trash image.jpg.