As configured in my dotfiles.
start new:
tmux
start new with session name:
#!/bin/bash | |
# Removes old revisions of snaps | |
# CLOSE ALL SNAPS BEFORE RUNNING THIS | |
echo "Current usage:"; | |
du -h /var/lib/snapd/snaps | |
echo ""; | |
set -eu | |
snap list --all | awk '/disabled/{print $1, $3}' | | |
while read snapname revision; do |
// Part of https://github.com/chris-rock/node-crypto-examples | |
// Nodejs encryption of buffers | |
var crypto = require('crypto'), | |
algorithm = 'aes-256-ctr', | |
password = 'd6F3Efeq'; | |
var fs = require('fs'); | |
var zlib = require('zlib'); |
const interval = 1000; | |
const acceptableDelay = 3; | |
let lastCheck = 0; | |
(function checkEventLoop() { | |
const now = Date.now(); | |
if (lastCheck) | |
if (now - lastCheck > interval + acceptableDelay) { | |
console.log('\x1b[31m', 'event loop delay', (now - lastCheck - interval) + 'ms', '\x1b[0m'); |
As configured in my dotfiles.
start new:
tmux
start new with session name:
Manual - By script | |
In machine A, | |
— | |
UNIX: | |
code --list-extensions | xargs -L 1 echo code --install-extension | |
— |
main_dir=~/Desktop/github-backups | |
github_users=(orgs/serendip-agency users/m-esm) | |
echo -e "\tBackup directory:$main_dir \n\n\tAccounts to backup:" | |
for a in ${github_users[@]}; do echo -e "\t\t${a}"; done | |
echo -e "\n\t$(mkdir $main_dir 2>&1)" | |
cd $main_dir | |
for user in ${github_users[@]}; do | |
repos=$(curl https://api.github.com/$user/repos --silent) | |
for row in $(echo "${repos}" | jq -r '.[] | @base64'); do | |
_jq() { echo ${row} | base64 --decode | jq -r ${1}; } |
# inline if | |
echo "result: $(if [ $(pgrep -c "myApplication^C -eq 1 ]; then echo "true"; else echo "false"; fi)" | |
var fs = require('fs'), | |
util = require('util'), | |
Stream = require('stream').Stream; | |
/** | |
* Create a bandwidth limited stream | |
* | |
* This is a read+writeable stream that can limit how fast it | |
* is written onto by emitting pause and resume events to | |
* maintain a specified bandwidth limit, that limit can |
function memorySizeOf(obj) { | |
var bytes = 0; | |
function sizeOf(obj) { | |
if(obj !== null && obj !== undefined) { | |
switch(typeof obj) { | |
case 'number': | |
bytes += 8; | |
break; | |
case 'string': |
convert "*.{png,jpeg}" -quality 100 outfile.pdf |