Skip to content

Instantly share code, notes, and snippets.

@davetownsend
davetownsend / gist:3145577
Created July 19, 2012 17:43
Make Xcode fast!!!
execute this into terminal and enjoy the speed!
defaults write com.apple.dt.XCode IDEIndexDisable 1
@davetownsend
davetownsend / gist:3148559
Created July 20, 2012 04:00
sublime text 2 must have links
sublime text 2 must have links
http://net.tutsplus.com/tutorials/tools-and-tips/lightning-fast-folder-and-file-creation-in-sublime-text-2/
http://net.tutsplus.com/tutorials/tools-and-tips/sublime-text-2-tips-and-tricks/
http://net.tutsplus.com/tutorials/tools-and-tips/essential-sublime-text-2-plugins-and-extensions/
01. Connect to the VPN (so OSX generates the racoon configuration file)
02. Copy the generated configuration file to /etc/racoon:
$ sudo cp /var/run/racoon/1.1.1.1.conf /etc/racoon
03. Edit the racoon configuration file with your favorite editor (vim):
$ sudo vim /etc/racoon/racoon.conf
04. At the bottom of the file comment out the line:
# include "/var/run/racoon/*.conf" ;
@davetownsend
davetownsend / node-and-npm-in-30-seconds.sh
Last active August 29, 2015 14:02
Install Node for zsh users
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.zshrc
. ~/.zshrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl -L https://www.npmjs.com/install.sh | sh
@davetownsend
davetownsend / gist:94bd1cd9165884d9b922
Last active June 29, 2018 05:13
Multiple Ehcache with Spring 4 Java Config
package org.dt.cachetest;
import net.sf.ehcache.config.CacheConfiguration;
import org.springframework.cache.annotation.CachingConfigurer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.ehcache.EhCacheCacheManager;
import org.springframework.cache.interceptor.KeyGenerator;
import org.springframework.cache.interceptor.SimpleKeyGenerator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@davetownsend
davetownsend / rename.groovy
Created November 26, 2014 15:25
Bulk file re-name with Groovy script
// needed to rename over 900 files in a dir from a pattern like
// noa_6989589000_201404080445010001.pdf to NAR6989589000.pdf where the 6989589000 part
// (different on every file) is the needed in the new file.
// simply run from the CLI: groovy rename.groovy
dir = "/path to files"
def pre = "NAR", ext = ".pdf"
new File(dir).eachFile() { f ->
def name = f.name.split('_')[1]
f.renameTo("${pre}${name}${ext}")
@davetownsend
davetownsend / gist:eb7c241240b1a1f95e9b
Created March 10, 2015 23:02
reload launchd.conf
# run from cli to re-load new enries in lanuchd.conf
grep -E "^setenv" /etc/launchd.conf | xargs -t -L 1 launchctl

Keybase proof

I hereby claim:

  • I am davetownsend on github.
  • I am davetownsend (https://keybase.io/davetownsend) on keybase.
  • I have a public key whose fingerprint is 9151 93CF B605 3101 DA87 F75D CCD3 E43A 7A70 A986

To claim this, I am signing this object:

@davetownsend
davetownsend / serverless.yml
Last active August 13, 2019 00:19
auth function config
functions:
auth:
handler: exampleAuth.verify
@davetownsend
davetownsend / serverless.yml
Created August 13, 2019 00:23
apigw auth config
exampleData:
handler: example.getExample
events:
- http:
path: /${self:provider.apiname}/read
method: get
authorizer:
name: auth
identitySource: method.request.header.Authorization
identityValidationExpression: ^Bearer [-0-9a-zA-z\.]*$