This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<select class="form-control" id="usstates"> | |
<option>Alabama</option> | |
<option>Alaska</option> | |
<option>Arizona</option> | |
<option>Arkansas</option> | |
<option>California</option> | |
<option>Colorado</option> | |
<option>Connecticut</option> | |
<option>Delaware</option> | |
<option>Florida</option> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
a=1 | |
for i in *.jpg; do | |
new=$(printf "thumb%04d.jpg" "$a") | |
convert "$i" -thumbnail 100x100^ -gravity center -extent 100x100 "$new" | |
echo "thumbnailed $i to $new" | |
let a=a+1 | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
a=1 | |
for i in *.jpg; do | |
new=$(printf "photo%04d.jpg" "$a") #04 pad to length of 4 | |
mv -- "$i" "$new" | |
echo "moved $i to $new" | |
let a=a+1 | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
usage() { | |
echo "----------------------------------------------------------------" | |
echo "`basename "$0"` -u [username] -p [password] -d [database] -t [target dir]" | |
echo "----------------------------------------------------------------" | |
echo " -u, required, database username" | |
echo " -p, required, database password" | |
echo " -d, required, database name" | |
echo " -t, optional, directory to place backup file" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
get_property() { | |
local target=$1 | |
local file=$2 | |
#echo target : $target | |
#echo file : $file | |
sed '/^\#/d' ${file} | grep ${target} | sed -e 's/ //g' | | |
while read LINE | |
do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE mysql; | |
UPDATE user SET Password = PASSWORD('your-root-password') | |
WHERE User = 'root'; | |
FLUSH PRIVILEGES; | |
# remove anonymous user | |
DELETE FROM user | |
WHERE User = ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Example output: | |
# badb24d | Fri Mar 20 14:27:51 2015 | [cworks] | little clean up | |
numLines="20" | |
if [[ $1 =~ '^[0-9]+$' ]] ; then | |
$numLines = $1 | |
fi | |
git --no-pager log -n $numLines --pretty=format:'%h | %ad | [%an] | %s%d' --date=local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# zip all commits between an earlier commit and a later commit | |
# $1 earlier commit | |
# $2 later commit | |
# $3 name of zip archive | |
IFS=$'\n' | |
files=($(git diff --name-only $1 $2)) | |
git archive -o $3 $2 "${files[@]}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
usage() { | |
echo "----------------------------------------------------------------" | |
echo "`basename "$0"` -u [username] -p [password] -d [database] -t [target dir]" | |
echo "----------------------------------------------------------------" | |
echo " -u, required, database username" | |
echo " -p, required, database password" | |
echo " -d, required, database name" | |
echo " -t, optional, directory to place backup file" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
function switchJava() { | |
if [ $# -ne 0 ]; then | |
removeFromPath '/System/Library/Frameworks/JavaVM.framework/Home/bin' | |
if [ -n "${JAVA_HOME+x}" ]; then | |
removeFromPath $JAVA_HOME | |
fi | |
export JAVA_HOME=`/usr/libexec/java_home -v $@` | |
export PATH=$JAVA_HOME/bin:$PATH |
NewerOlder