Skip to content

Instantly share code, notes, and snippets.

View Swivelgames's full-sized avatar

Joseph Dalrymple Swivelgames

View GitHub Profile
@Swivelgames
Swivelgames / carousel-example.css
Created March 1, 2015 04:46
Simple JavaScript Carousel
@Swivelgames
Swivelgames / hosts.js
Last active January 16, 2023 05:04
Node.js: Simple "Virtual Hosts" with Bouncy
module.exports = [
[ 'sterm.bluelogicteam.com', 8881 ],
[ /^(www\.)?bluelogicteam.com$/, 8882 ],
[ /^(www\.)?toggleswitch.tv$/, 8883 ]
];
@Swivelgames
Swivelgames / num2bin.js
Last active September 7, 2021 20:57
Convert Base-10 Number to 8-bit Binary
Base-10 Number: 33
/* (Divide by each number, then multiply by the remainder to the next column's number) */
Value Column ┆128━━━┓ ┆ 64 ┆32 ┆16 ┆8 ┆4 ┆2 ┆1 ┆
┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ ┆┄┄┄┄┄┄┃┄┄┄┄┄┄┄┄┆┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┆┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┆┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┆┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┆┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┆┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┆┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┆
Current Number ┆33 ┃ ┏▶.2578125 * 128 ┏▶.515625 * 64 ┏▶.03125 * 32 ┏▶.0625 * 16 ┏━━▶.125 * 8 ┏━━▶.250 * 4 ┏━━▶.500 * 2 ┆
┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ ┆ ▼ ┃ ┆ ▼━━━━━━━━━┛ ┃ ┆ ▼━━━━━━━━┛ ┃ ┆▼━━━━━━━━┛ ┃ ┆▼━━━━━━┛ ┃ ┆▼━━━━━┛ ┃ ┆▼━━━━━━┛ ┃ ┆▼━━━━━━┛ ┆
Divide ┆33 / 128 ┃ ┆33 / 64 ┃ ┆33 / 32 ┃ ┆1 / 16 ┃ ┆1 / 8 ┃ ┆1 / 4 ┃ ┆1 / 2 ┃ ┆1 / 1 ┆
Carry Remainder ┆0 .2578125 ▷┛ ┆0 .515625 ▷━━┛ ┆1 .03125 ▷━━━┛ ┆0 .0625 ▷━━━┛ ┆0 .125 ▷━━━┛ ┆0 .250 ▷━━━┛ ┆0 .500 ▷━━━┛ ┆1 .000 ┆
Store Quotient Int ┆▼ ┆▼ ┆▼ ┆▼ ┆▼ ┆▼ ┆▼ ┆▼ ┆
@Swivelgames
Swivelgames / README
Created March 26, 2020 15:00 — forked from dejanr/README
OSX, X11, dwm, urxvt, vim environment
OSX Apps
- Total Spaces, for keeping X11 in different space and faster switching
- MenuAndDockless for hidding topbar menu
X11 - Macports
- sudo port install xorg-server
- sudo port install xinit
- sudo port install terminus-font dejavu-fonts bitstream-fonts
Suckless - suckless.org
" Get the defaults that most users want.
source $VIMRUNTIME/defaults.vim
if has("vms")
set nobackup " do not keep a backup file, use versions instead
else
set backup " keep a backup file (restore to previous version)
if has('persistent_undo')
set undofile " keep an undo file (undo changes after closing)
endif
@Swivelgames
Swivelgames / tmux.conf
Last active April 8, 2019 17:00
My tmux configuration
set-option -g default-shell /bin/zsh
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
@Swivelgames
Swivelgames / .gitconfig
Last active February 12, 2019 22:16
Useful Git Aliases
# ...
[pull]
# Use rebase when running git-pull (Recommended)
rebase = true
[core]
# Treat filename casing strictly
ignorecase = false
[pager]
# Do not open up the default kernel's pager for git-branch
branch = false
@Swivelgames
Swivelgames / gist:94f6b2a10c298f59dbdd96f1f75fe6f8
Last active February 12, 2019 22:01 — forked from devisnotnull/installing_kubernetes_on_proxox.md
Installing Kubernetes on Proxox, Herzner

Installing Kubernetes on Proxmox

For this example i shall be using a dedicated server from Hertzner.https://www.hetzner.de/en/. A shout out to hetzner if your looking for cheap and beefy dedicated hosting then these guys are your best bet.

Setting up the Hertzer server

This guide assumes your server has Debian 8 (Jessie installed)

Config when tested

@Swivelgames
Swivelgames / Sorting Results By Date Relevance, Bias Towards Future.md
Last active February 12, 2019 21:58
Sorting Results By Date Relevance, Bias Towards Future

Sorting Results By Date Relevance, Bias Towards Future

The purpose of this script is to demonstrate a sort function (@26-32) that reorders an array (dates => sortedDates) based on proximity to a specified date (search and d3o), with a bias towards future dates.

Use case includes searching for a history-related item in the past given a date. This functions serves to find the closest item relative to a date resolved from speech. For example, it is the assumption that when a user requests an item by date using "Last Tuesday", where no item exists on the date resolved from "Last Tuesday", that the user's bias will be towards the closest date more future to the one specified. This is based off of the additional assumption that the requester's memory is more likely to mistake "Wednesday" for "Tuesday", rather than "Monday" for "Tuesday" because "Wednesday" is closer to the current date, and thus their memory of it was likely to be more vivid.

These assumptions are not supported by any studies or scientif

@Swivelgames
Swivelgames / dance.js
Last active October 3, 2018 19:13
Dance elements on a webpage
const randBetween = (min, max) => Math.floor(Math.random() * max) + min;
const dance = () => {
const all = document.body.querySelectorAll('*');
return Array.prototype
.slice.apply(all)
.reduce(
(promise, e) => promise.then(
new Promise((resolve, reject) => setTimeout(() => {