Skip to content

Instantly share code, notes, and snippets.

View zkxs's full-sized avatar

zkxs

View GitHub Profile
@zkxs
zkxs / userChrome.css
Created July 11, 2018 00:39
Firefox Dark Mode
/*
* Edit this file and copy it as userChrome.css into your
* profile-directory/chrome/
*/
/*
* This file can be used to customize the look of Mozilla's user interface
* You should consider using !important on rules which you want to
* override default settings.
*/
@zkxs
zkxs / FizzBuzz.java
Last active January 8, 2022 07:39
Alas, no interviewer has ever asked me to fizzbuzz
import java.util.function.IntPredicate;
import java.util.stream.Collectors;
import java.util.Arrays;
import java.util.List;
/**
* Here's the same program, but in Java this time to demonstrate the
* boilerplate difference between Java and Scala.
*
* My solution to the classic fizz-buzz problem.
@zkxs
zkxs / map_capslock_to_f13.reg
Created December 22, 2016 18:28
Windows registry patch to use CAPSLOCK as F13
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,64,00,3a,00,00,00,00,00
@zkxs
zkxs / clock_divider.vhd
Last active November 3, 2015 03:44
Washing Machine FSM
-- Author: Michael Ripley
-- Create Date: 01:46:02 10/08/2015
-- Module Name: clock_divider - Behavioral
-- Description: If clock period is 10ns and divisor is 10, Q's period will be
-- 100ns. Essentially this is a clock divider where you can
-- specifiy an arbritrary divisor.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
@zkxs
zkxs / binarysearch.c
Created October 29, 2015 12:28
Test case for a binary search function
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// a linked-list node
struct node {
char *word;
struct node *next;
};
@zkxs
zkxs / TwoWordPalindrome.scala
Last active September 16, 2015 12:48
/r/dailyprogrammer Challenge #232 Bonus
import scala.collection.immutable.{HashSet, SortedSet}
import scala.collection.mutable.MutableList
import java.io.{BufferedWriter, FileWriter}
object TwoWordPalindrome {
val milliPerNano = 1000000d // 1 million milliseconds in a nanosecond
val outFileName = "two-word-palindromes.txt" // name of file found palindromes will be written to
val twoWordPalindromes = MutableList[(String, String)]() // list that results will be appended to
@zkxs
zkxs / Braces.java
Last active August 29, 2015 14:27
Double Brace Initialization
import java.util.*;
class Braces {
public static void main(String[] args) {
List<String> list = new ArrayList<String>(){{
add("michael");
add("was");
add("here");
}};
@zkxs
zkxs / psgrep
Last active August 29, 2015 14:25 — forked from minkcv/psgrep
grep for a process
#!/bin/bash
ps -Ne u
ps aux | fgrep "$1" | fgrep -v fgrep | fgrep -v $$
@zkxs
zkxs / pathgrep.sh
Created July 20, 2015 18:47
Search for $1 on the path, and print the filename if we find it
#!/bin/bash
#magically arrayify $PATH
IFS=':' read -a arr <<< "$PATH"
# iterate
for i in "${arr[@]}"; do
# grep for arg 1
ls -1 "$i" | fgrep "$1"
done
@zkxs
zkxs / mingw-i686.sh
Created July 20, 2015 18:11
Cross compilation scripts
#!/bin/sh
PREFIX=i686-w64-mingw32
export CC=$PREFIX-gcc
export CXX=$PREFIX-g++
export CPP=$PREFIX-cpp
export RANLIB=$PREFIX-ranlib
exec "$@"