Skip to content

Instantly share code, notes, and snippets.

View charlesbedrosian's full-sized avatar

Charles Bedrosian charlesbedrosian

  • Chicago, IL USA
View GitHub Profile
@charlesbedrosian
charlesbedrosian / php_postgresql.rb
Created May 8, 2012 04:47 — forked from sj26/php_postgresql.rb
Homebrew formula for PHP PostgreSQL extensions
require 'formula'
require 'net/http'
# This is an odd formula which adapts itself to whatever version of PHP
# is installed with the current version of OS X to install the missing
# PostgreSQL extension.
class PhpPostgresql < Formula
homepage 'http://www.php.net/'
# author: Samuel Cochran <[email protected]>
@charlesbedrosian
charlesbedrosian / build_batch_file.sql
Created March 1, 2013 16:59
Given a database, dumps each table in the database to a tab delimited file.
declare @server_name varchar(40)
declare @db_name varchar(40)
select @server_name = 'win7b', @db_name='io'
select '
BCP "DECLARE @colnames VARCHAR(max);DECLARE @tab char(1);SELECT @tab=char(9);SELECT @colnames = COALESCE(@colnames + @tab, '''') + column_name from ' + @db_name + '.INFORMATION_SCHEMA.COLUMNS where TABLE_NAME=''' + name + '''; select @colnames;" queryout HeadersOnly.csv -c -T -S ' + @server_name + '
BCP '+@db_name+'.dbo.'+name+' out TableDataWithoutHeaders.csv -c -T -S ' + @server_name + '
copy /b HeadersOnly.csv+TableDataWithoutHeaders.csv '+name+'.txt
del HeadersOnly.csv
del TableDataWithoutHeaders.csv
@charlesbedrosian
charlesbedrosian / SQL Server Dump to CSV.vbs
Created March 3, 2013 19:57
vbscript/wsh script to dump all tables in the indicated SQL database to CSV files. Replaces CrLf with \r\n and replaces NULL values with <null> string
Option Explicit
Dim server_name, db_name
Dim cs, cn, rsTables, rsData, sql, rsCount
Dim line, fso
Dim outfile
Dim i
Dim lineCount, lineTotalCount, baseMessage
server_name = "win7b"
db_name = "io"
@charlesbedrosian
charlesbedrosian / build.sh
Created March 9, 2013 22:03
XCode post build script to setup settings with current build information, different for Debug and Release versions
#get commit stats (date and SHA)
commit_sha=`git rev-parse --short HEAD`
commit_ts=`git show -s --format="%ci" $sha`
commit_dt=${commit_ts:0:16}
commit_count=`git log --oneline | wc -l | tr -d ' '`
SETTINGSBUNDLEPATH="$CODESIGNING_FOLDER_PATH/Settings.bundle/Root.plist"
#where are we getting the original data from?
@charlesbedrosian
charlesbedrosian / batch export graffles
Last active December 16, 2015 16:40
This script prompts for a folder, then recursively generates PDFs of all graffles found, using the name of the graffle and saving the PDF to the graffle's same folder.
property kGraffleAliasList : {}
tell application "Finder"
set source_folder to choose folder with prompt "Please select directory."
my createList(source_folder)
kGraffleAliasList
my convertGraffles()
@charlesbedrosian
charlesbedrosian / remove_key.sh
Last active August 29, 2015 14:11
Utility to scan a settings plist and remove a entries matching a key from the provided list.
#/bin/bash
if [ $# -ne 2 ]; then
echo "Invalid parameters specified."
echo "expected syntax to remove keys in list from plist file some.plist:"
echo "./remove_key.sh some.plist key1,key2,key3"i
exit 1
fi
plist="$1"
keysToRemove="$2"
@charlesbedrosian
charlesbedrosian / update_settings_with_git.sh
Created December 19, 2014 05:36
Takes inforrmation from git repo and updates the settings bundle values for known keys. Also sets the version information based on the number of git commits as a means to increment the bundle version and appends it to the version string.
#/bin/bash
function set_default_value_for_key {
key_to_find=$1
value_to_set=$2
cnt=`/usr/libexec/PlistBuddy -c "Print PreferenceSpecifiers:" $plist | grep "Dict"|wc -l | tr -d ' '`
cnt=`expr "$cnt" '-' '1'`
for i in `seq 0 $cnt`; do
key=`/usr/libexec/PlistBuddy -c "Print PreferenceSpecifiers:${i}:Key" $plist 2>/dev/null`
if [[ $key == $key_to_find ]]; then
@charlesbedrosian
charlesbedrosian / testflight.sh
Last active August 29, 2015 14:11
push build to testflight. This is based on the codebase at https://gist.github.com/c0diq/2213571 but greatly reduced and refocused for automated use.
#!/bin/bash
if [[ "$WORKSPACE" == "" ]]; then
WORKSPACE=$(pwd)
fi
#specify these configuration values
TESTFLIGHT_API_TOKEN=""
TESTFLIGHT_TEAM_TOKEN=""
@charlesbedrosian
charlesbedrosian / build-and-deploy.sh
Created May 23, 2016 05:53 — forked from jrschumacher/build-and-deploy.sh
Ionic Automated Build and Deploy to HockeyApp
#!/bin/bash
PROJECT_NAME=MyApp
SCHEME_NAME=MyApp
STARTTIME=$(date +%s);
set -e
set -x
### Install dependencies
echo "--- Install dependencies [Time Elapsed $(($(date +%s) - $STARTTIME))s]"
@charlesbedrosian
charlesbedrosian / 010_copy_build_extras.js
Last active March 19, 2020 11:01
Copy build-extras to platforms/android
#!/usr/bin/env node
//goes in hooks/after_platform_add/
var fs = require('fs');
rootdir = process.argv[2],
android_dir = rootdir + '/platforms/android';
gradle_file = rootdir + '/build-extras.gradle';
dest_gradle_file = android_dir + '/build-extras.gradle';