Skip to content

Instantly share code, notes, and snippets.

Joseph Dalrymple Swivelgames

Block or report user

Report or block Swivelgames

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View .vimrc
" 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 Apr 8, 2019
My tmux configuration
View tmux.conf
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 Feb 12, 2019
Useful Git Aliases
View .gitconfig
# ...
[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 / dance.js
Last active Oct 3, 2018
Dance elements on a webpage
View dance.js
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(() => {
@Swivelgames
Swivelgames / revert-git-changes.md
Last active Aug 28, 2018
Simple revert all commits between HEAD and COMMIT_X in git
View revert-git-changes.md

Grab the commit you want to revert back to

$ git log

You should see a less'd list of your log in descending chronological order (top of the list is your most recent commit).

  • Find the commit you want to revert back to.
  • Copy the hash (hexadecimal string, like: "b4533eeac95f970d131452b08db9094e8e07a260")
@Swivelgames
Swivelgames / hidePRfilesWithExtension.md
Last active Apr 10, 2018
Hide Files with FILE_EXTENSION when previewing PRs
View hidePRfilesWithExtension.md

Hide files with certain extension when previewing PR’s on Github

Usage

Change FILE_EXTENSION and then paste into Developer Tools console and execute.

Hidden feature: Automatically steals your information and uploads it to Chinese servers. I mean, uh… use this to hack someone’s facebook account! :D

@Swivelgames
Swivelgames / FirebaseUpdateCfg.js
Created Jan 22, 2018
Firebase Configuration Updater
View FirebaseUpdateCfg.js
#!/usr/bin/env node
/* eslint-disable import/no-extraneous-dependencies, no-console */
const path = require('path');
const yargs = require('yargs');
const fs = require('fs');
const { spawn } = require('child_process');
const argv = yargs
.option('f', {
alias: 'file',
View gist:94f6b2a10c298f59dbdd96f1f75fe6f8

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 / toTwelveHour.js
Last active Nov 13, 2017
24 to 12 hour clock
View toTwelveHour.js
/* golf */
const toTwelveHour = time => {
const [hr,min] = time.split(':');
return `${hr>12?hr-12:hr==0?12:hr}:${min}${hr>12?'PM':'AM'}`;
}
/* expanded utility */
const toTwelveHour = (time) => {
const [hour, min] = time.split(':');
const suffix = hour > 12 ? 'PM' : 'AM';
@Swivelgames
Swivelgames / num2bin.js
Last active Feb 12, 2019
Convert Base-10 Number to 8-bit Binary
View num2bin.js
Base-10 Number: 33
/* (Divide by each number, then multiply by the remainder to the next column's number) */
Value Column ┆128━━━┓ ┆ 6432168421
┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ ┆┄┄┄┄┄┄┃┄┄┄┄┄┄┄┄┆┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┆┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┆┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┆┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┆┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┆┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┆┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┆
Current Number33 ┃ ┏▶.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 ┆▼ ┆▼ ┆▼ ┆▼ ┆▼ ┆▼ ┆▼ ┆▼ ┆
You can’t perform that action at this time.