Skip to content

Instantly share code, notes, and snippets.

@andromedarabbit
andromedarabbit / 0_reuse_code.js
Last active August 29, 2015 14:13
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
# for Python 3
str(sample_bytes, 'utf8')
@andromedarabbit
andromedarabbit / gist:7077eb9f66c183a9368e
Created June 5, 2015 05:16
Install Python packages using requirements.txt
pip3 install -r requirements.txt
@andromedarabbit
andromedarabbit / turn-on-puppet-syntax-highlight-in-vim.sh
Created June 15, 2015 06:00
Turn on puppet syntax highlight in vim
sudo apt-get install vim-puppet
ln -s /usr/share/vim/addons/syntax/puppet.vim ~/.vim/plugin/
from django.core import mail
@property
is_django_in_test_mode():
return hasattr(mail, 'outbox')
@andromedarabbit
andromedarabbit / check-if-remote-udp-port-is-open
Last active August 29, 2015 14:23
Check if remote UDP port is open
# check if the remote ntp port is open
sudo nc -uv 10.0.0.11 123

Description

When using Homebrew (http://brew.sh) and searching formulas or pull requests you may get the dreaded error message: Github API Rate limit exceeded

Let's fix that! (yeah!)


Short version

Create a new Personal Token in your Github Account Settings (Sidebar: Applications) and then copy the Token. In the Terminal, use export HOMEBREW_GITHUB_API_TOKEN=YOURAPITOKENWITHFUNKYNUMBERSHERE (change that to your API Token) or add that to your .bash_profile and then do source .bash_profile.

@andromedarabbit
andromedarabbit / reset-the-last-commit-from-github.sh
Created July 22, 2015 01:54
Reset the last commit from GitHub
git push -f origin HEAD^:master
@andromedarabbit
andromedarabbit / squash-commits-with-git.sh
Last active August 29, 2015 14:25
Squash Commits with Git
# ref: http://davidwalsh.name/squash-commits-git
# switch to master branch
git checkout master
# ensure our master is up to date
git pull remoteRepoName master
# use git rebase to consolidate
git rebase -i master
@Inject
private PlatformTransactionManager transactionManager;
private void someMethod(boolean roolback) {
TransactionStatus transactionStatus = transactionManager.getTransaction(new DefaultTransactionDefinition());
// Do something
if (rollback) {