Skip to content

Instantly share code, notes, and snippets.

View e0da's full-sized avatar

Justin Force e0da

View GitHub Profile
@e0da
e0da / simcity_2000_mouse_scroll_bindings.ahk
Last active July 12, 2021 06:11
Use the vertical scrolling for zoom and horizontal scrolling for rotation when playing SimCity 2000 (SIMCITY.EXE)
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; https://gist.github.com/e0da/40d551e1302738d931d0c61c163acb22
#IfWinActive ahk_exe SIMCITY.EXE
WheelUp::Send {Home}
WheelDown::Send {End}
@e0da
e0da / xterm-256color-italic.terminfo
Created May 9, 2018 18:35 — forked from sos4nt/xterm-256color-italic.terminfo
A xterm-256color based TERMINFO that adds the escape sequences for italic
# A xterm-256color based TERMINFO that adds the escape sequences for italic.
#
# Install:
#
# tic xterm-256color-italic.terminfo
#
# Usage:
#
# export TERM=xterm-256color-italic
#
@e0da
e0da / sql.rb
Created February 20, 2019 18:12
cur.execute(<<-'SQL'.gsub('%s', tablename))
INSERT INTO `%s`
SELECT cs.nodeid, dbs.name database, rels.name `table`,
reps.name `index`, sum(reads) reads,
sum(deletes+inserts+replaces) writes,
count(cs.replica) replicas
FROM system.`databases` AS dbs
JOIN system.`relations` AS rels USING (db)
JOIN system.`representations` AS reps
ON (reps.relation = rels.table)
@e0da
e0da / DellXPS15_9560_AHCI_RAID.md
Created September 4, 2019 04:32 — forked from chenxiaolong/DellXPS15_9560_AHCI_RAID.md
Switching between AHCI and RAID on the Dell XPS 15 (9560)

Switching between AHCI and RAID on the Dell XPS 15 (9560)

This guide likely applies to other models and, potentially, even laptops from other OEMs that have NVME drives. However, I've only tested this on my Dell XPS 15 (9560) with the OEM Windows installation from the Signature Edition model.

Switching from RAID to AHCI

Switching from RAID to AHCI is significantly simpler than switching from AHCI to RAID. All that's needed is a successful boot to Safe Mode.

  1. To set the default boot mode to Safe Mode, use msconfig.exe or open an admin cmd/PowerShell window and run:
@e0da
e0da / favify.bash
Created November 30, 2019 06:59
favify
#!/bin/bash -ex
# https://gist.github.com/justinforce/f1ddc69f63f95deeb3c0f0d2cf44b202
input=${1:-favicon.svg}
output=${2:-favicon.ico}
# https://gist.github.com/azam/3b6995a29b9f079282f3#gistcomment-2958717
convert \
-density 256x256 \
-background transparent \
terminator=$(mktemp --dry-run /tmp/terminator.XXX)
echo "touch $terminator to stop"
(
while true; do
if [[ -f "$terminator" ]]; then
kill "$CHILD_PID"
echo "Killed $CHILD_PID because the main container terminatord."
exit
fi
sleep 1
@e0da
e0da / Enable no-restricted-syntax ForOfStatement when extending airbnb-base in .eslintrc.js
Last active August 26, 2020 16:39
Disable the airbnb style guide rules that violates the no-restricted-syntax rule when using for...of loops in JavaScript, which are incredible and a wonderful and perfectly valid alternative to Array.prototype.forEach. Fight me.
module.exports = {
extends: ["airbnb-base"],
rules: {
"no-restricted-syntax": [
"error",
/**
* for...of is wonderful! Copy the rest of Airbnb's rules.
* Gist permalink: https://gist.github.com/e0da/e539c6aa220eedd0cf76dc94e1e26ed9
* Airbnb source: https://github.com/airbnb/javascript/blob/a24dc34a4a2748c99006a48e997aa0a06b1d4d94/packages/eslint-config-airbnb-base/rules/style.js#L339-L357
* Feature discussion: https://github.com/airbnb/javascript/issues/1271#issuecomment-548688952
@e0da
e0da / README.md
Last active September 16, 2020 20:55
Prompts

e0da prompt

e0da prompt example

.zshrc goes in $HOME, everything else goes in $HOME/share, and you want to brew install zsh-git-prompt. I'm using Gruvbox here with macOS Terminal.

@e0da
e0da / socket.rb
Created January 2, 2021 23:28 — forked from RickCarlino/socket.rb
Bi-directional TCP socket in Ruby
#Jeepers, this standard library has everything!
require 'socket'
server = TCPServer.new "127.0.0.1" , 4000
while connection = server.accept
Thread.new(connection) do |client|
while (client_input = client.gets.chomp)
@e0da
e0da / .bash_profile
Created July 14, 2021 00:25
Expand ulimit on bash login
# Add to .bash_profile to prevent processes from running out of file handles
# Limit determined by guess and check on macOS 10.15.7 Catalina
if uname | grep -q Darwin; then
# ulimit -n is OK because we already confirmed it's macOS
# shellcheck disable=SC2039
ulimit -n "${ULIMIT_N:-49152}"
fi