Skip to content

Instantly share code, notes, and snippets.

View edm00se's full-sized avatar

Eric McCormick edm00se

View GitHub Profile
@thibmaek
thibmaek / nvmi.sh
Last active June 22, 2017 22:49
Update node with nvm, migrating global modules
# Usage: nvmi v6.0.1 (will install specified version)
# Usage: nvmi_latest (will install latest node version)
# these functions will replace the current 'default' version known in the shell.
# to install a node version next to your current 'default' just use nvm install vX.X.X
function nvmi() {
CURRENT=$(node -v)
nvm install $1 --reinstall-packages-from=$CURRENT
@JohannesBuchner
JohannesBuchner / rsyncprogress.py
Last active June 18, 2023 18:51
Progress bar for rsync
"""
Progress bar for rsync
========================
Shows file progress and total progress as a progress bar.
Usage
---------
Run rsync with -P and pipe into this program. Example::
@forabi
forabi / Webpack 2.0.7-beta vs Rollup
Last active August 20, 2024 13:14
Webpack 2 vs Rollup
❯ rollup --version
rollup version 0.25.3
❯ time rollup -c ./rollup.js
rollup -c ./rollup.js 4.65s user 0.22s system 118% cpu 4.131 total
❯ time webpack
Hash: ebb00bbccd954c114d3c
Version: webpack 2.0.7-beta
Time: 3623ms
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@simonhaenisch
simonhaenisch / rpi-osmc-and-shairport.md
Last active February 15, 2018 00:50
RPi: OSMC & shairport-sync #raspberrypi

Raspberry Pi with OSMC and shairport-sync

It is assumed that OSMC is installed and running on the Raspberry, and the Airport service should be disabled (though it doesn't have to be, but who needs two Airplay services). OSMC is based on Debian 8 (Jessie).


If you get Error opening terminal when opening nano or alsamixer, update the current TERM:

export TERM=xterm
@jsynowiec
jsynowiec / yarn-or-npmi.js
Last active April 28, 2019 10:50
[yarn with npm fallback] Try to install dependencies using yarn or fall back to npm if yarn is not available #nodejs #yarn #npm
const os = require('os');
const exec = require('child_process').exec;
switch (os.platform()) {
case 'win32':
exec('yarn --version', (err, stdout, stderr) => {
if (err) {
exec('npm install');
return;
} else {
@RomkeVdMeulen
RomkeVdMeulen / gists-solarized-dark.css
Created November 9, 2016 12:58
CSS for styling embedded gists in Solarized Dark
/* Solarized Dark for embedded gists
http://ethanschoonover.com/solarized
*/
.gist .highlight, .gist .blob-code-inner { font-size: inherit !important }
.gist .highlight { line-height: 1.25em !important }
.gist .gist-meta { background-color: #073642 !important; color: #93a1a1 !important }
.gist .gist-meta a { color: #268bd2 !important }
.gist .gist-data, .gist .highlight { background-color: #002b36 !important; color: #93a1a1 !important }
@peterdemartini
peterdemartini / command.sh
Last active March 6, 2025 07:29
Exclude node_modules in timemachine
find `pwd` -type d -maxdepth 3 -name 'node_modules' | xargs -n 1 tmutil addexclusion
@wesbos
wesbos / async-await.js
Created February 22, 2017 14:02
Simple Async/Await Example
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee
});
}
@xjamundx
xjamundx / webpack-unused-files.sh
Last active November 20, 2020 12:51
Quickly identify files unused by webpack
# ----------------------------------- #
webpack --display-modules | awk '{print $2}' | grep ^\.\/ > files-processed.txt;
cd public/js/; # assumes all your files are here
find . -name "*.js" | grep -v eslint | grep -v __ > ../../files-all.txt; # excludes __tests__ and .eslintrc files
cd ../..;
cat files-all.txt | xargs -I '{}' sh -c "grep -q '{}' files-processed.txt || echo '{}'";
rm files-processed.txt files-all.txt;
# ----------------------------------- #