Skip to content

Instantly share code, notes, and snippets.

@markjaquith
markjaquith / gist:4500280
Last active April 17, 2024 21:06
Bash command to fix a quirk with Sublime Text 2's "subl" command. Sometimes, when using it, under hard-to-pinpoint circumstances, it will open up Sublime Text 2 completely blank (i.e. the file you asked it to open will not be open). This snippet fixes that by essentially kicking subl under the table to wake it up and then passing on the command …
function subl() {
if [[ ! -p /dev/stdin ]]; then
command subl > /dev/null 2>&1
fi
command subl "$@"
}
@aaronzirbes
aaronzirbes / shrink-git-repo.sh
Created January 19, 2013 05:32
This script will help you remove large files from your git repo history and shrink the size of your repository.
#!/bin/bash
echo "Finding and Purging Big Files From Git History"
echo "=============================================="
echo ""
echo "http://naleid.com/blog/2012/01/17/finding-and-purging-big-files-from-git-history/"
echo ""
pushd "$(git rev-parse --show-toplevel)" > /dev/null
"Ann Lenczewski (DFL)" <rep.ann.lenczewski@house.mn>
"Diane Loeffler (DFL)" <rep.diane.loeffler@house.mn>
"Greg Davids (R)" <rep.greg.davids@house.mn>
"Sarah Anderson (R)" <rep.sarah.anderson@house.mn>
"Tom Anzelc (DFL)" <rep.tom.anzelc@house.mn>
"Bob Barrett (R)" <rep.bob.barrett@house.mn>
"John Benson (DFL)" <rep.john.benson@house.mn>
"Lyndon Carlson Sr. (DFL)" <rep.lyndon.carlson@house.mn>
"Jim Davnie (DFL)" <rep.jim.davnie@house.mn>
"Steve Drazkowski (R)" <rep.steve.drazkowski@house.mn>
@SlexAxton
SlexAxton / .zshrc
Last active April 25, 2023 03:57
My gif workflow
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
@jeffsheets
jeffsheets / gist:5292986
Last active July 20, 2018 14:39
Hibernate DetachedCriteria using subqueries exists clause, while eager fetching the lazy collection that is in the exists clause, and running via Spring HibernateTemplate findByCriteria, and limit results to max of 2000.
/*
* HQL would look something like this:
*
* from Person p join fetch p.addresses address
* where exists (
* from Address addr left join addr.state st
* where addr.personId = p.id
* and st.abbreviation = :abbreviation
* )
*/
@timyates
timyates / .bash_profile.sh
Last active December 22, 2015 10:49
Two bash functions to switch JVM on OS X (with GVM installed as well)
export JAVA7_HOME=`/usr/libexec/java_home -v 1.7*`
export JAVA8_HOME=`/usr/libexec/java_home -v 1.8*`
function jdk7 {
export JAVA_HOME=$JAVA7_HOME
set_path
echo "Using Java 7 $JAVA_HOME"
}
function jdk8 {
@timyates
timyates / ReactiveRPS.groovy
Last active December 30, 2015 11:39
Reactive Rock Paper Scissors with Groovy and RxJava
@Grab( 'com.netflix.rxjava:rxjava-groovy:0.15.1' )
import groovy.transform.*
import rx.*
@CompileStatic
class RPSRX {
enum Result {
WIN, LOSE, DRAW
}
@nickbauman
nickbauman / ios_imperatives_for_approval.md
Last active November 1, 2019 12:10
Condensed iOS Human Interface Guidelines, formulated as imperatives.

Condensed iOS Human Interface Guidelines

Imperatives for AppStore approval

For iPhone app developers. Emphasis on getting the fastest app store approval. Everything stated as suggestion made into an imperative. When "violating" these imperatives, you can check for yourself what the caveats are. Generally speaking, deviating will more likely cause your app to be hung up in approval.

You can read this entire document in about 20 minutes. This is faster than reading and understanding the entire Human Interface Guidelines.

Overview

@aaronhanson
aaronhanson / SftpServer.groovy
Created December 31, 2014 15:56
Simple Groovy Sftp Server
@Grab(group='org.apache.sshd', module='sshd-core', version='0.13.0')
import org.apache.sshd.SshServer
import org.apache.sshd.server.PasswordAuthenticator
import org.apache.sshd.server.command.ScpCommandFactory
import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider
import org.apache.sshd.server.session.ServerSession
import org.apache.sshd.server.sftp.SftpSubsystem
import org.apache.sshd.server.shell.ProcessShellFactory

Ratpack Production Tunings

# cat /etc/security/limits.conf

*         hard    nofile      500000
*         soft    nofile      500000
root      hard    nofile      500000
root      soft    nofile      500000