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 / 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 / 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 \
@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 / 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)