Skip to content

Instantly share code, notes, and snippets.

View karagenit's full-sized avatar

Caleb Smith karagenit

View GitHub Profile
View analysis.rb
#!/usr/bin/env ruby
require 'uri'
# Helper to get hostnames from referrer fields
def get_host(url)
begin
URI.parse(url).host.to_s
rescue StandardError
''
@karagenit
karagenit / Makefile
Last active December 1, 2017 00:32
PHP Hardcoded Credential Cleaner
View Makefile
main: install
install:
sudo cp ./clean-creds.sh /usr/bin/clean-creds
sudo chmod 777 /usr/bin/clean-creds
@karagenit
karagenit / alsa.sh
Created November 24, 2017 03:40
Fix Audio Drivers on Debian 9 + ThinkPad T530
View alsa.sh
#!/usr/bin/env bash
sudo modprobe snd-hda-intel
sudo alsactl init
View EfficientSwap.java
// TODO: fix imports
public class EfficientSwap {
/**
* This method should print its parameters in opposite order.
* E.g. swap(3, 4) should print 4 then 3.
*/
public static void swap(int a, int b) {
a = a * b;
@karagenit
karagenit / birthday
Last active November 17, 2017 17:17
View birthday
#define OUT_A 0
#define OUT_B 1
#define OUT_C 2
#define OUT_D 3
#define SEG_G 4
#define DRIVER_ENABLE 5
#define DISP_DASH -1
#define DISP_BLANK -2
@karagenit
karagenit / node.sh
Created November 12, 2017 17:14
Fix Node on Debian
View node.sh
#!/usr/bin/env bash
sudo ln -s /usr/bin/nodejs /usr/bin/node
View fsearch.sh
#!/usr/bin/env bash
if [ ! $1 ]
then
echo "Usage: fsearch [STRING]"
exit
fi
grep -nr . -e $1
View gemfind.sh
#!/bin/bash
if [ ! $1 ]
then
echo "Usage: gemfind.sh GEMNAME"
exit
fi
echo `gem list | grep $1`
@karagenit
karagenit / header.sh
Last active July 30, 2017 20:21
Rename WPI File Headers
View header.sh
#!/bin/sh
find . -type f -exec sed -i -e 's/FIRST (20[0-1][0-9])-(20[0-1][0-9])\./FIRST \1-2017./g' {} \;
find . -type f -exec sed -i -e 's/FIRST (20[0-1][0-9])\./FIRST \1-2017./g' {} \;
View git-branch-link.sh