Skip to content

Instantly share code, notes, and snippets.

View e0da's full-sized avatar

Justin Force e0da

View GitHub Profile
@e0da
e0da / README.md
Created January 27, 2023 17:48 — forked from dsample/README.md
ASCII art diagrams

ASCI art characters for creating diagrams

Characters:

Single line

  • ASCII code 191 = ┐ ( Box drawing character single line upper right corner )
  • ASCII code 192 = └ ( Box drawing character single line lower left corner )
  • ASCII code 193 = ┴ ( Box drawing character single line horizontal and up )
  • ASCII code 194 = ┬ ( Box drawing character single line horizontal down )
@e0da
e0da / gist:1989787
Created March 6, 2012 23:35
Hashing and checking SSHA passwords in Ruby
#!/usr/bin/env ruby
require 'base64'
require 'digest'
# get 16 random hex bytes
#
def new_salt
16.times.inject('') {|t| t << rand(16).to_s(16)}
end
@e0da
e0da / prusa_mini_conveniently_park_head.gcode
Last active April 1, 2022 23:34
PrusaSlicer end gcode for Prusa Mini which parks head conveniently
; Written by u/mix579 <https://www.reddit.com/user/mix579/>
; Source: <https://www.reddit.com/r/prusa3d/comments/seidbl/comment/hukj2fc/?utm_source=share&utm_medium=web2x&context=3>
;
; PrusaSlicer end gcode for Prusa Mini
; Last updated 20210111 - RF - Inspired by Bob George
G4 ; wait
G92 E0 ; prepare to retract
G1 E-1 F2100 ; retract
; Anti-stringing end wiggle
G91 ; use relative coordinates
@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
@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 / 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 / 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 / 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
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 / 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 \