Skip to content

Instantly share code, notes, and snippets.

View mcoffin's full-sized avatar

Matt Coffin mcoffin

View GitHub Profile
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
#!/bin/bash
if [ ! -f "$1" ]; then
echo 'Usage: find_tabbers FILE'
exit 1
fi
grep -P -n '\t' "$1" | awk -F ':' '{print $1;}' | xargs -L 1 -I NUMLINE git blame -L NUMLINE,NUMLINE "$1" | bash -c 'cat -'
@mcoffin
mcoffin / client-cgroups.sh
Created February 13, 2019 20:27
LoL wine cgroups scripts
#!/bin/bash
cd /sys/fs/cgroup/cpuset
for pname in wineserver LeagueClientUx.exe LeagueClientUxRender.exe; do
pid=$(pidof "$pname")
echo "pidof $pname = $pid"
echo $pid >> cgroup.procs
done
@mcoffin
mcoffin / toggle-db-prochot.py
Created March 14, 2018 01:46
Toggles DB PROCHOT flag on linux
#!/usr/bin/env python3
import subprocess
db_prochot_loc = '0x1fc'
def main():
p = subprocess.run(['rdmsr', db_prochot_loc], stdout=subprocess.PIPE, encoding='utf8')
orig_str = p.stdout.rstrip()
v = int('0x' + orig_str, 16) ^ 0b1
#![feature(nonzero)]
extern crate core;
use core::nonzero::NonZero;
use std::ffi::CStr;
use std::os::raw::*;
use std::slice;
const GLX_CONTEXT_PROFILE_MASK_ARB: c_int = 0x9126;
@mcoffin
mcoffin / LeagueClient.sh
Created November 6, 2017 21:56
Wrapper script for League of Legends client in wine
#!/bin/bash
set -e
league_dir=$(dirname $0)
export MESA_GL_VERSION_OVERRIDE=4.5COMPAT
export VBLANK_MODE=0
export MESA_GLTHREAD=true
resolution=$(xrandr | grep ' connected ' | awk '{print $4}' | egrep -o '^[0-9]+x[0-9]+')
width=$(echo $resolution | awk -F 'x' '{print $1}')
height=$(echo $resolution | awk -F 'x' '{print $2}')
@mcoffin
mcoffin / FilterMerges.groovy
Last active February 3, 2017 03:14
Jenkins groovy script for the promoted builds plugin to filter out gitlab merges.
import com.dabsquared.gitlabjenkins.cause.GitLabWebHookCause;
import com.dabsquared.gitlabjenkins.cause.CauseData;
GitLabWebHookCause cause = build.getCause(GitLabWebHookCause.class);
return cause.getData().getActionType().equals(CauseData.ActionType.PUSH);
module Util.Stream where
import Prelude
import Control.Monad.Aff (Aff, makeAff)
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Exception (EXCEPTION, Error)
import Control.Monad.ST (ST, newSTRef, modifySTRef, readSTRef, runST)
import Data.Monoid (class Monoid)
import Node.Encoding (Encoding(..))
import Node.Stream (Read, Readable, Stream, onData, onError, onEnd, onDataString)
@mcoffin
mcoffin / Cargo.toml
Created November 7, 2016 16:39
Rust const_fn panic
[package]
name = "playground"
version = "0.1.0"
authors = ["Matt Coffin <mcoffin13@gmail.com>"]
[dependencies.inner]
path = "./inner"
joystickIndex = 1
pedalsIndex = 2
vJoyIndex = 0
x = joystick[joystickIndex].x
y = joystick[joystickIndex].y
leftPedal = -((joystick[pedalsIndex].zRotation - 1000.0) / 2.0)
rightPedal = -joystick[pedalsIndex].y
z = rightPedal - leftPedal
throttle = joystick[joystickIndex].sliders[0]