Skip to content

Instantly share code, notes, and snippets.

@tybenz
tybenz / urlshort.sh
Created February 7, 2013 23:02
Bash URL Shortener
#!/bin/bash
echo "Generating URL..."
FULL_PATH="/Users/tbenzige/Projects/aws"
#Count is kept based on a list.txt file
#list.txt is a plain text file meant to show relationships between URLs
#Instead of a running count, we just count the lines in list.txt
INITIAL=`echo -n $(cat $FULL_PATH/list.txt | wc -l)`
NUM="$INITIAL/4"
@tybenz
tybenz / lenovo-mute-tut.md
Last active July 29, 2021 06:34
Enabling mic mute button and light on Lenovo Thinkpads

#####Copied from askubuntu's Enabling mic mute button and light on Lenovo Thinkpad

There are two possible "hardware" indicators (to show that mute is on or off):

The Power button light (green) will blink to show when mute is on The Mic mute button light (orange) will be on or off to show mute status (just like in Windows)

Solution 2 requires a patched thinkpad_acpi kernel module, and is only recommended for advanced users who know what they are doing. This is because the patch is not included by the thinkpad_acpi developers by default, (See this discussion for more details).

###Common Steps

/* vim: set tabstop=4 softtabstop=4 shiftwidth=4 expandtab: */
var path = require( 'path' ),
sys = require('sys'),
exec = require('child_process').exec;
module.exports = function ( grunt ) {
grunt.initConfig({
init: {},
express: {
custom: {

VIMRC

  1. git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
  2. Replace the contents of your .vimrc with this one
  3. Open vim and run :BundleInstall
  4. cd ~/.vim/bundle/vim-javascript
  5. rm -Rf syntax

Steps 4 & 5 are to get rid of conflicts. vim-javascript has indentation info for JS, but vim-javascript-syntax has much better syntax highlighting.

@tybenz
tybenz / map.geojson
Created August 9, 2013 19:20
via:geojson.io
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tybenz
tybenz / for-real.sh
Created June 21, 2013 20:08
Make a commit with previous commit message plus "for real"
#!/bin/bash
message="`git log --pretty=%B -1` - for real"
git commit -m "$message"
@tybenz
tybenz / term
Created June 5, 2013 18:22
term
#!/bin/bash
hour=`date "+%k"`
if [ "$hour" -ge "$TERMINATOR_MORNING" ] && [ "$hour" -lt "$TERMINATOR_EVENING" ];then
terminator -p light
else
terminator -p default
fi
@tybenz
tybenz / .vimrc
Created June 5, 2013 18:22
.vimrc
let hour = strftime("%k")
let hour = substitute(hour, '^\s*\(.\{-}\)\s*$', '\1', '')
let morning = $TERMINATOR_MORNING
let evening = $TERMINATOR_EVENING
if (morning + 0) <= hour && hour < (evening + 0)
color Tomorrow
else
color Tomorrow-Night
endif
noremap <leader>d :color Tomorrow-Night<CR>
@tybenz
tybenz / index.html
Last active December 17, 2015 22:59
A CodePen by Tyler Benziger. Boids - Simple flocking boids algorithm ~ from when I was first experimenting with AI... plenty of improvements to be made now that I look back at it :)
<script src="script.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="style.css"
<canvas id='canvas'></canvas>
./enemy.js:Game.Entity.Enemy = Game.Entity.extend({
./enemy.js: this.x += Game.unit;
./enemy.js: this.x -= Game.unit;
./enemy.js:Game.Entity.Enemy.Monster = Game.Entity.Enemy.extend({
./entity.js:Game.Entity = Class.extend({
./entity.js: init: function( x, y ) {
./entity.js: tempCanvas, tempContext,
./entity.js: if ( x !== null && y !== null ) {
./entity.js: this.x = x;
./entity.js: tempContext = tempCanvas.getContext( '2d' );