Skip to content

Instantly share code, notes, and snippets.

View brettinternet's full-sized avatar
👋

Brett brettinternet

👋
View GitHub Profile
@brettinternet
brettinternet / ExtractISO.ps1
Last active February 16, 2021 19:21
PowerShell script to extract all ISO images in subfolders with 7zip - see improved batch script below
Get-ChildItem $folderPath -recurse | %{
if($_.Name -match "^*.`.iso$")
{
$parent="$(Split-Path $_.FullName -Parent)";
write-host "Extracting $($_.FullName) to $parent"
$arguments=@("x", "`"$($_.FullName)`"", "-o`"$($parent)`"");
$ex = start-process -FilePath "`"C:\Program Files\7-Zip\7z.exe`"" -ArgumentList $arguments -wait -PassThru;
@brettinternet
brettinternet / Redux nested Object.assign()
Last active January 24, 2017 02:12
For returning new state in redux with nested objects from a reducer's initialState
let state = {
nestedObj: {
x: 1,
y: 2,
},
h: 10
}
let addObj = {
@brettinternet
brettinternet / Average array elements for dataset
Last active January 30, 2017 21:19
Average every third element in an array for a more concise dataset
let arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
avgs = [],
sum = 0;
arr.forEach((el, i) => {
sum += el;
if ((i + 1) % 3 == 0) {
avgs.push(sum / 3);
sum = 0;
}
let fibonacci = (n) => {
if(n <= 2) {
return 1;
} else {
return fibonacci(n - 1) + fibonacci(n - 2);
}
};

Change the base url of a gist to cdn.rawgit.com

@brettinternet
brettinternet / configs
Created February 24, 2017 14:54
user configs
# .tmux.conf.local
====
set -g default-terminal "screen-256color"
set-option -g status-position bottom
set-window-option -g xterm-keys on
bind-key -n S-Up set-option -g status
bind-key -n S-Down set-option -g status
bind-key -n S-Left previous-window
bind-key -n S-Right next-window
set-option -g status-fg white
@namespace html url(http://www.w3.org/1999/xhtml);
@namespace xul url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
/*
Author: Twily
Description: Minimal flat styled tabs for Australis
Compitability: Firefox Nightly v31.0a1 - v32.0a1 (Australis)
CSS Variables were introduced to Firefox in v29.0a1
Website: http://twily.info/
*/
@brettinternet
brettinternet / now_playing.osascript
Created February 25, 2017 08:23 — forked from JorenSix/now_playing.osascript
This osascript gets and returns the meta data of the track that is currently playing in Spotify on Mac OS X.
#!/usr/bin/osascript
#
# now_playing.osascript
#
# Osascript to fetch the meta data of the currently playing
# track in Spotify. This works only on Mac OS X.
tell application "System Events"
set myList to (name of every process)
end tell
@brettinternet
brettinternet / tmux-cheatsheet.markdown
Created March 3, 2017 02:05 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@brettinternet
brettinternet / js-huh.js
Last active March 5, 2017 23:28
Go home Javascript, you're drunk
console.log(9999999999999999); // 10000000000000000
[] + {} // '[object Object]'
{} + [] // 0
console.log(!+[]+[]+![] === 'truefalse'); // true
Math.max( ...[] ) // -Infinity
Math.max( undefined ) // NaN
console.log( …[] ) // undefined