Skip to content

Instantly share code, notes, and snippets.

@jasonrobot
jasonrobot / delete-merged-branches.sh
Last active December 21, 2016 22:30
Cool git commands (some shell in there too). Alias these to stuff in your shell if you want to use them quickly.
#deletes all branches that have been merged into master (except your current branch) (substitute "master" for whatever branch you want to clean against)
git branch --merged master | grep -v "\*" | xargs -n 1 git branch -d
#you can leave off the last command to just list them
@jasonrobot
jasonrobot / assert.java
Last active February 16, 2017 21:19
The magic of assertions
if (3 != 3)
{
fail("equality check failed on 3");
}
/*
* That's fine, except that we're usually comparing dynamic data retrieved from the app.
* Sometimes we aren't even comparing against static data
*/
for (String result : results)
{
@jasonrobot
jasonrobot / touchpad.fish
Last active March 20, 2018 21:18
toggles the synaptics touchpad on and off, or you can specify on and off
#!/usr/bin/env fish
# Usage:
# run with no args to toggle between on and off
# pass a single arg "on" or "off" to do exactly what you'd expect
# drop it in ~/bin with a nice name (I have ~/bin/tp) or bind it to a hotkey or something like that
function turn-on
echo "turning on"
synclient touchpadoff=0
(defun beginning-of-line-or-indentation ()
"Move to beginning of line, or indentation."
(interactive)
(let ((start (point)))
(back-to-indentation)
;; now if point is the same as when we started, we're already at indent start
(if (= start (point))
(beginning-of-line))))
(global-set-key (kbd "C-a") 'beginning-of-line-or-indentation)
@jasonrobot
jasonrobot / volume.fish
Created April 24, 2018 15:51
Bind this to your media keys to control whatever pulse audio syncs are active.
#!/usr/bin/env fish
set -l current_sinks (pactl list short sinks | grep -i "running" | awk "{ print \$1 }")
for sink in $current_sinks
switch $argv[1]
case mute unmute
echo "toggling mute"
pactl set-sink-mute $sink toggle
case up
<project name="MyProject" default="dist" basedir=".">
<description>
simple example build file
</description>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<target name="init">
@jasonrobot
jasonrobot / timer.lisp
Created May 8, 2018 22:58
Simple command line invoked timer. I plan to add some way of notifying.
#!/usr/bin/sbcl --script
;;; Documentation:
;;; Commentary:
;;; Code:
(defun timer-tick ()
"Waits for 1 second"
@jasonrobot
jasonrobot / test-ng-deps.java
Created May 15, 2018 23:45
Z runs, Y runs and fails, X skips, W goes anyways, but after Y.
public class TestTestDeps
{
@Test(alwaysRun = true)
public void testZ()
{
System.out.println("z is running");
assertEquals(1, 1);
}
@Test(dependsOnMethods = "testZ")
(in-package :cl-user)
(defpackage :hello-world-system
(:use :asdf))
(in-package :hello-world-system)
(defsystem "hello-world"
:version "0.1.0"
:author "Jason"
:license "LLGPL"
:description "Say hi."
@jasonrobot
jasonrobot / br.pl
Last active July 6, 2018 19:41
Make a break in your terminal without clearing the screen! Give it an arg for how many lines you want (default 3).
#! /usr/bin/env perl
use strict;
my $default = 3;
my $lines = @ARGV[0] || $default;
$lines = 3 if $lines < 0;
for( my $i = $lines; $i > 0; $i-- ) {
if ( $i == ($lines / 2) ||
$i == (($lines + 1) / 2) ) {