Skip to content

Instantly share code, notes, and snippets.

View fsmv's full-sized avatar

Andrew Kallmeyer fsmv

  • Los Angeles, California
View GitHub Profile
@fsmv
fsmv / pass.go
Last active October 9, 2022 21:15
A runnable go script that creates an http basic auth password hash compatible with .htaccess (this is just the password part, you have to add username:<hash>)
/*?sr/bin/env go run "$0" "$@"; exit $? #*/
// This is actually not a shebang, the first line is both valid shell script and valid go code
// Just run: chmod +x pass.go; ./pass.go
package main
import (
"bufio"
"crypto/sha256"
"encoding/base64"
"fmt"
@fsmv
fsmv / dont-use-communication-device.patch
Created May 24, 2018 02:37
In Windows, make Mumble use the Default Device not the DefaultCommunicationsDevice by default. Patch based on commit 2ad8c65165441c8250c7b5327e9cd1a858d833cc of https://github.com/mumble-voip/mumble
diff --git src/mumble/DirectSound.cpp src/mumble/DirectSound.cpp
index fb2b1d10..238fd853 100644
--- src/mumble/DirectSound.cpp
+++ src/mumble/DirectSound.cpp
@@ -115,7 +115,7 @@ static BOOL CALLBACK DSEnumProc(LPGUID lpGUID, const WCHAR* lpszDesc,
const QList<audioDevice> DXAudioOutputRegistrar::getDeviceChoices() {
QList<dsDevice> qlOutput;
- qlOutput << dsDevice(DXAudioOutput::tr("Default DirectSound Voice Output"), DSDEVID_DefaultVoicePlayback);
+ qlOutput << dsDevice(DXAudioOutput::tr("Default DirectSound Voice Output"), DSDEVID_DefaultPlayback);
@fsmv
fsmv / simple.vim
Last active June 25, 2023 04:36
A simpler .vimrc with better default settings for programming and with golang autoformatting and automatic listchars
" Optional plugin manager see: https://github.com/junegunn/vim-plug
" Do this first so we can overwrite anything it does after
"call plug#begin('~/.vim/plugged')
" Automatically source .local.vimrc files in directories you open
"Plug 'thinca/vim-localrc'
"call plug#end()
set title " Set terminal title
set mouse=a " Turn on mouse support
set undolevels=1000
@fsmv
fsmv / git_surgery.md
Last active April 14, 2023 19:17
How to merge multiple git repos into one repo, and preserve history

Merging multiple git repos into one

tl;dr:

  1. Import other repos as branches
  2. Move the files in the other repos into subdirectories for each project
  3. Rebase the other repo branches onto the master
  4. Merge everything into master in order

Note: placeholders are in angle brackets.

@fsmv
fsmv / vim.desktop
Created April 29, 2017 08:08
A vim desktop icon file for gnome. Put it in ~/.local/share/applications/ or /usr/share/applications/. It uses the gvim icon, if you don't have it installed then change the icon to gedit.
[Desktop Entry]
Name=vim
Comment=Edit text files
Exec=vim %U
Terminal=true
Type=Application
MimeType=text/plain;
Actions=new-window;new-document;
Keywords=Text;Editor;Plaintext;Write;
Icon=gvim
@fsmv
fsmv / regex.md
Last active April 29, 2017 22:14
A primer/tutorial on the theory and practice regular expressions

Regular Expressions

In theory:

  • Regular expressions define a set of strings called the Language
    • If a string matches the regular expression, it's in the language set
  • There are only three operations (because math strives to be minimal)
    • Concatenation - "a concatenated with b" is just ab
    • Or - written a|b. In most regex libraries
    • Klenee Star - zero or more of the expression it's applied to; writtena*
@fsmv
fsmv / MathClass.txt
Created January 19, 2017 16:04
WARNING: Bad code. I found this on my old computer and thought it was interesting to see my parsing before I knew any parsing. I was 16 and teaching myself C++ for the first time when I wrote this.
//////////////////////////////////////////////
// //
// MathClass: //
// version = 0.01 planning //
// modified = 08/09/2010 //
// license = GPL //
// //
//////////////////////////////////////////////
TODO:
@fsmv
fsmv / build.bat
Created June 10, 2016 02:38
Loading and executing code directly from an obj file on Windows!
@echo off
rem Set up the Visual Studio 2013 compiler environment variables
call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x64
cl -c lib.cpp
cl runner.cpp /link user32.lib
@fsmv
fsmv / logger.cpp
Created June 29, 2015 23:13
C++ Logger
/**
* The MIT License (MIT)
*
* Copyright (c) 2015 Andrew Kallmeyer
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@fsmv
fsmv / envinfo
Created March 12, 2015 04:34
Performance Testing Scripts
#!/bin/sh
echo "CPU Model: `grep -m1 'model name' /proc/cpuinfo | cut -d' ' -f3- | tr -s ' '`"
echo "CPU/Core Speed (MHz): `grep -m1 'cpu MHz' /proc/cpuinfo | cut -d' ' -f3` MHz"
echo "RAM: `grep 'MemTotal' /proc/meminfo | awk '{ print $2,$3 }'`"
echo "Operating System: `uname -sr`"
echo "Interconnect: N/A"
echo "g++ version: `g++ --version | head -1`"
echo "javac version: `javac -version 2>&1`"
echo "icpc version: `icpc --version | head -1`"