Skip to content

Instantly share code, notes, and snippets.

View atomize's full-sized avatar
🎹
♩♩

Berti atomize

🎹
♩♩
View GitHub Profile
@atomize
atomize / tmux.md
Created November 17, 2017 00:16 — forked from avelino/tmux.md
tmux cheat sheet

tmux - terminal multiplexer

Managing tmux sessions:

$ tmux      # start tmux server
$ tmux at   # attach running sessions to a terminal
$ tmux ls   # list running tmux sessions

Sharing sessions between terminals:

$ tmux new -s session_name # make new named session

$ tmux at -t session_name # attach to exist session (allowing shared sessions)

@atomize
atomize / i3-cheat-sheet.md
Created November 17, 2017 00:15 — forked from JeffPaine/i3-cheat-sheet.md
i3 Window Manager Cheat Sheet

i3 Window Manager Cheat Sheet

$mod refers to the modifier key (alt by default)

General

  • startx i3 start i3 from command line
  • $mod+<Enter> open a terminal
  • $mod+d open dmenu (text based program launcher)
  • $mod+r resize mode ( or to leave resize mode)
  • $mod+shift+e exit i3
@atomize
atomize / shellworkflow.vim
Created November 15, 2017 17:07
.vimrc function to run script in VIM and display output in split window
function! s:ExecuteInShell(command)
let command = join(map(split(a:command), 'expand(v:val)'))
let winnr = bufwinnr('^' . command . '$')
silent! execute ':w'
silent! execute winnr < 0 ? 'vnew ' . fnameescape(command) : winnr . 'wincmd w'
setlocal buftype=nowrite bufhidden=wipe nobuflisted noswapfile nowrap number
silent! execute 'silent %!'. command
silent! redraw
silent! execute 'au BufUnload <buffer> execute bufwinnr(' . bufnr('#') . ') . ''wincmd w'''
silent! execute 'nnoremap <silent> <buffer> <LocalLeader>r :call <SID>ExecuteInShell(''' . command . ''')<CR>'
@atomize
atomize / SCPtoS3.sh
Last active November 9, 2017 19:45
SCP to S3 bucket (requires AWS cli tools)
#!/bin/sh
# Original: https://github.com/dial-once/docker-crons/blob/master/scripts/scp-to-s3.sh
# SCP script to make a remote folder sent to AWS S3!
#
# # # # # # #
# Env vars #
# # # # # # #
# - SCP_HOST - server hostname
# - SCP_PORT - server port
# - SCP_USER - server username
@atomize
atomize / LookupTablesShorthand.js
Created November 3, 2017 00:20
Lookup tables shorthand in javascript.
// Longhand
if (type === 'aligator') {
aligatorBehavior();
}
else if (type === 'parrot') {
parrotBehavior();
}
else if (type === 'dolphin') {
dolphinBehavior();
}
@atomize
atomize / CSVtoJSON.sh
Created October 28, 2017 22:13
CSV to JSON converter using BASH -- best one from updates in comments of https://gist.github.com/dsliberty/3de707bc656cf757a0cb
#!/bin/bash
# CSV to JSON converter using BASH
# original script from https://gist.github.com/dsliberty/3de707bc656cf757a0cb
# Usage ./csv2json.sh input.csv > output.json
#set -x
shopt -s extglob
input="${1:-}"
<!DOCTYPE html>
<ol contenteditable oninput="">
<li>Press enter</li>
</ol>
<script>
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
var list = document.querySelector('ol');
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
@atomize
atomize / i3_wm_application_specific_rules.config
Created October 22, 2017 21:16
Rules for enabling floating on specific applications in i3wm
#### RULES FOR SPECIFIC APPLICATIONS ####
# from: http://www.linuxlusers.com/2012/12/24/i3-window-manager-tip-making-specific-applications-and-child-windows-open-in-floating-mode-or-with-other-custom-settings/
# by APPLICATION (WM_CLASS)
# Note: class is typically useful for applying custom settings to
# to entire applications, including child windows. If this
# isn't want you want see the ROLE section, below.
# Tip: To find out what these values might be run:
# xprop | grep -i 'class'
for_window [class="File-roller"] floating enable, border normal
for_window [class="Speedcrunch"] floating enable, border normal
@atomize
atomize / AWSCORS.xml
Created October 16, 2017 01:52
Allow Dangerous Public JSON from S3
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<MaxAgeSeconds>5000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
@atomize
atomize / spreadOperatorSyntax.js
Created September 23, 2017 19:03
Example of concatenating arrays using spread syntax in pure Javascript.
var arr1 = [0, 1, 2];
var arr2 = [3, 4, 5];
arr1 = [...arr2, ...arr1]; // arr1 is now [3, 4, 5, 0, 1, 2]
// source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator