Skip to content

Instantly share code, notes, and snippets.

@danielcarr
danielcarr / move_gopro_in_directory.py
Created June 30, 2013 22:25
This script was used for a very specific purpose once off in a project, and has no real re-usability value, but is retained here for posterity. I needed to move the "Go Pro!" button (reminding the user to upgrade to payed version) from the end of my menus to the beginning, so they would be more visible. The menu structure is determined by an App…
#! /usr/bin/env python
def move_gopro_in_file(filename):
file = open(filename)
lines = file.readlines()
file.close()
gopro = lines[-3]
from string import whitespace
#! /usr/bin/env bash
# hashapass.com method for generating passwords
# based on the script by Simon Elmir at http://hashapass.com/en/cmd.html
export IFS="" #read will now preserve whitespace
read -rp "parameter: " PARAMETER
read -rsp "password: " PASSWORD
echo
read -n 2 -rp "how many characters: " LENGTH
#! /usr/bin/env bash
function print_usage() {
echo
echo "$0 <file_to_validate> [<file_with_hash_of_file>] [-p]"
echo "If no hash file is passed, the script will assume it is <filename>.md5"
echo "The -p flag will print out whether the file hash matches the hash provided"
echo "Exits 0 if the computed hash matches the provided hash and 1 otherwise"
echo
}
@danielcarr
danielcarr / .vimrc
Created November 17, 2015 19:59
Vim config file
colorscheme slate
syntax on "syntax highlighting
set number "line numbers
set expandtab "use spaces for tab
set tabstop=4
set softtabstop=4
set shiftwidth=4
@danielcarr
danielcarr / pod-update-post-checkout
Last active September 16, 2022 12:38 — forked from kreeger/pod-install-post-checkout
A post-checkout hook for running pod install if necessary checking out a branch
#!/usr/bin/env sh
from_branch=$1
checked_out_branch=$2
check_out_type=$3 # changing branches = 1; checking out a file = 0
# If checking out a fresh clone
if test $from_branch = 0000000000000000000000000000000000000000 ; then
from_branch=`git hash-object -t tree /dev/null` # a hash representing an empty tree/repo
fi
#!/usr/bin/env python
ALEFPOINT = 0x05D0
TAFPOINT = 0x05EA
VALUES = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 20, 30, 40, 40, 50, 50, 60, 70, 80, 80, 90, 90, 100, 200, 300, 400]
FINALS = [u'\u05DA', u'\u05DD', u'\u05DF', u'\u05E3', u'\u05E5']
alefbetrange = [unichr(a) for a in range(ALEFPOINT, TAFPOINT + 1)]
gematrimap = dict(zip(alefbetrange, VALUES))
alefbet = ''.join([u for u in alefbetrange if u not in FINALS])
@danielcarr
danielcarr / backupconf
Last active April 6, 2016 12:57
Jenkins build server administration scripts
#!/usr/bin/env bash
archiveflag="--keep-archive"
deleteflag="--delete"
nullflag="-"
archivedirectory="${HOME}/Library/JenkinsArchives"
configdir="${archivedirectory}/configs"
archivename=jenkins.tar.gz
@danielcarr
danielcarr / bump_build_number
Last active May 5, 2016 09:48
Script for incrementing build iOS app build number before building when multiple versions of the same app need to be released for testing
#! /usr/bin/env bash
usage() {
echo Usage:
echo "$0 <info_plist_file> [<build_number_directory>] [-v]"
echo "If a build number directory is given, the saved number will be checked,"
echo " and if it exists and is greater than the build number in the info plist,"
echo " it will be incremented and saved back to the given build number directory."
echo "If it does not exist, or it is smaller than the info plist build number,"
echo " the info plist number will be incremented and saved back."
@danielcarr
danielcarr / update-postman
Created June 5, 2017 11:49
Update the Postman linux app automatically
#! /usr/bin/env bash
POSTMAN_URL="https://dl.pstmn.io/download/latest/linux64"
DL_LOCATION="/tmp/postman"
UPDATE_NAME="update.tar.gz"
ORIG_NAME="Postman"
NEW_NAME="postman"
LINK_LOCATION="/opt/bin"
DL_ARCHIVE="${DL_LOCATION}/${UPDATE_NAME}"
@danielcarr
danielcarr / collectlibs.sh
Created January 18, 2018 07:36
Copy Android locally built libraries from a library source path into the /libs/ directory of a specific module
#! /usr/bin/env bash
# if there are no arguments, or if the first argument is -h or --help
if test ${1:--h} = -h -o ${1:--h} = --help; then
echo "Usage: ${0} <buildtype> <src lib root> <destination lib dir> [<libnames>...]"
echo "<buildtype> is eg debug or release"
echo "<src lib root> is the directory containing the repos where libraries are to be found"
echo "<destination lib dir> is the directory within the repo to which files should be copied"
echo "<libnames> are the names of all libraries that should be copied (eg 'libcore')"
echo "if no libraries are specified, the libraries already found in the destination will be copied again."