Skip to content

Instantly share code, notes, and snippets.

View BirkhoffLee's full-sized avatar
🎓
Learning about CS

birkhoff BirkhoffLee

🎓
Learning about CS
View GitHub Profile
@BirkhoffLee
BirkhoffLee / keybase.md
Created March 6, 2016 12:45
Keybase.io Verification

Keybase proof

I hereby claim:

  • I am BirkhoffLee on github.
  • I am birkhoff (https://keybase.io/birkhoff) on keybase.
  • I have a public key whose fingerprint is D72A 7413 71B8 393D 6327 5256 4B09 ECA2 27EF 342B

To claim this, I am signing this object:

@BirkhoffLee
BirkhoffLee / gta_online_kick_everyone.bat
Last active September 26, 2016 09:38
Kick everyone in the public session of GTA Online.
@echo off
CLS
if "%minimized%"=="" set minimized=true & start /min cmd /c "%~dpnx0" & goto :EOF
:init
setlocal DisableDelayedExpansion
set "batchPath=%~0"
for %%k in (%0) do set batchName=%%~nk
set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
@BirkhoffLee
BirkhoffLee / installPowerlineForBashAndTmux.sh
Last active November 1, 2016 15:02
Installer for Powerline for Bash & Tmux, not tested, for OS X 10.11.6
#!/bin/bash
python_version=3.5.2
cd
sudo sed -i '1iexport LANG=en_US.UTF-8' ~/.profile
sudo sed -i '1iexport LC_ALL=en_US.UTF-8' ~/.profile
brew update
@BirkhoffLee
BirkhoffLee / iterm_profile.json
Created January 29, 2017 09:24
iTerm2 profile set
{
"Link Color" : {
"Red Component" : 0.023,
"Color Space" : "Calibrated",
"Alpha Component" : 1,
"Blue Component" : 0.678,
"Green Component" : 0.27
},
"Tags" : [
@BirkhoffLee
BirkhoffLee / installMySQL.sh
Last active March 16, 2017 09:45
Install MySQL server for BungeeCord and Spigot plugins on Linode Ubuntu 16.04
#!/bin/bash
# Settings
USERNAME="mysqluser"
SSH_PUBKEY="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQClxraaf0yoYrLWhxD1gdFopR/20Z54spf4ecbAXTch42HLpMimFh18qNa4easbeP8SPjt94arV+BxHFmCaK41YsP1tJL/5I1DsnPyYew5ZJjWGBeGF7nMvht5ostKPOa+tpuQP/z5goE7gQxF+46nMnO2q7bHG4+6xl4fLq+yoWY8vpBgW6RUTPPExhHXaV+KxFBmroW1AXvcM2nxnrAQFcG6mvPhnIUpDjYtUvq48lch34MwuX+ckPYXCBinDTekS/ZV9/H4XjVsv/Uay3cAz5VG5SuwXsSCJfgMJFGw86wYRcFe401rnG1LnWJczHPCtzA6CuY25UdptcQYCH+lV birkhoff@Birkhoffs-MBPR.local"
# Check permissions
if [[ $(id -u) -ne 0 ]]; then
printf "The script must be run as root! \n"
exit 1
@BirkhoffLee
BirkhoffLee / dump.js
Created April 29, 2017 08:47
Dump all data of minecraft-ids.grahamedgecombe.com as JSON
items={}
$("table.items tr").each((i, tr) => {
item = {}
item.id = $("td.id", tr).html()
item.name = $("span.text-id", tr).html().slice(11).slice(0, -1).toUpperCase()
item.data = (item.id.indexOf(":") != null) ? item.id.split(":")[1] : "";
item.displayname = $("td.row-desc > span", tr).html()
items[item.id]=item
})
console.log(JSON.stringify(items))
sudo apt-get update; sudo apt-get install default-jdk screen wget -y; screen -S minecraft; mkdir -p ~/minecraft/; cd ~/minecraft/; wget -O https://s3.amazonaws.com/Minecraft.Download/versions/1.11.2/minecraft_server.1.11.2.jar; echo "eula=true" > eula.txt; java -Xmx1G -Xms512M -jar minecraft_server.1.11.2.jar nogui
@BirkhoffLee
BirkhoffLee / installDocker.sh
Last active May 3, 2017 05:47
Install Docker on Ubuntu with nice security settings.
#!/bin/bash
# Settings
USERNAME="docker"
SSH_PUBKEY="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQClxraaf0yoYrLWhxD1gdFopR/20Z54spf4ecbAXTch42HLpMimFh18qNa4easbeP8SPjt94arV+BxHFmCaK41YsP1tJL/5I1DsnPyYew5ZJjWGBeGF7nMvht5ostKPOa+tpuQP/z5goE7gQxF+46nMnO2q7bHG4+6xl4fLq+yoWY8vpBgW6RUTPPExhHXaV+KxFBmroW1AXvcM2nxnrAQFcG6mvPhnIUpDjYtUvq48lch34MwuX+ckPYXCBinDTekS/ZV9/H4XjVsv/Uay3cAz5VG5SuwXsSCJfgMJFGw86wYRcFe401rnG1LnWJczHPCtzA6CuY25UdptcQYCH+lV birkhoff@Birkhoffs-MBPR.local"
# Check permissions
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
let a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
const unflatten = (arrayToUnflatten, unflattenLength) => {
return Promise.all(new Array(Math.ceil(arrayToUnflatten.length / unflattenLength)).fill('').map((_, index) => new Promise(resolve => {
resolve(arrayToUnflatten.slice(index * unflattenLength, index * unflattenLength + unflattenLength))
})))
}
unflatten(a, 2).then(result => console.log(result))
@BirkhoffLee
BirkhoffLee / install.sh
Last active November 9, 2017 11:55
Install magic-warmhole on CentOS 7
#!/bin/sh
sudo yum install -y python-pip libsodium-devel python-devel
sudo pip install --upgrade pip
sudo pip install magic-wormhole