Skip to content

Instantly share code, notes, and snippets.

@RoryDungan
RoryDungan / mouse.sh
Created January 4, 2016 09:03
Fix crazy fast cursor movement with Razer DeathAdder mouse on Ubuntu
#!/bin/bash
xinput list |
grep -E 'DeathAdder.*pointer' |
awk -F"=" '{print $2}' |
awk '{print $1}' |
while read -r id
do
xinput --set-prop $id "Device Accel Constant Deceleration" 3
xinput --set-prop $id "Device Accel Velocity Scaling" 1
done
@RoryDungan
RoryDungan / Preferences.sublime-settings
Last active April 5, 2016 01:51
Sublime Text 3 settings
{
"added_words":
[
"favourite"
],
"always_show_minimap_viewport": true,
"bold_folder_labels": true,
"ignored_packages":
[
],
@RoryDungan
RoryDungan / .vimrc
Last active November 12, 2016 02:16
.vimrc
" Indentation
set smartindent
" set tabstop=2
" set shiftwidth=2
set tabstop=4
set shiftwidth=4
set expandtab
set autoindent
" Enable autocompletion for file paths
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
required = true
[user]
name = Rory Dungan
email =
[diff]
tool = winmerge
[difftool "winmerge"]
set-option -g default-shell /usr/bin/fish
set -s escape-time 1
set -g prefix C-v
setw -g mode-keys vi
set-option -g base-index 1
setw -g pane-base-index 1
BoldAsFont=-1
Font=Consolas
FontHeight=11
Transparency=off
Term=xterm-256color
CursorType=block
Scrollbar=none
Locale=en_AU
Charset=UTF-8
import Control.Monad
type KnightPos = (Int, Int)
moveKnight :: KnightPos -> [KnightPos]
moveKnight (c,r) = do
(c',r') <- [(c+2,r-1), (c+2,r+1), (c-2,r+1), (c-2,r-1)
,(c+1,r-2), (c+1,r+2), (c-1,r+2), (c-1,r-2)
]
guard (c' `elem` [1..8] && r' `elem` [1..8])
[Binding]
public class PropertyChangedExample : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
void DereferenceManagedObject(int32_t handle)
{
assert(handle >= 0 && handle < managedObjectsRefCountLen);
if (handle != 0)
{
auto numRemain = --managedObjectRefCounts[handle];
assert(numRemain >= 0);
if (numRemain <= 0)
{
ReleaseObject(handle);
@RoryDungan
RoryDungan / count-commands.js
Created June 12, 2018 09:59
Work out which commands I use in Fish the most
'use strict'
const fs = require('fs')
const path = require('path')
const os = require('os')
const df = require('data-forge')
// Read the history of commands executed in the Fish shell and work out which
// are used the most!
const filePath = path.join(os.homedir(), '.local/share/fish/fish_history')