Skip to content

Instantly share code, notes, and snippets.

View kvz's full-sized avatar

Kevin van Zonneveld kvz

View GitHub Profile
@kvz
kvz / prometheus-processes.sh
Created January 14, 2021 20:25
prometheus-processes.sh
#!/usr/bin/env bash
set -o pipefail
set -o errexit
set -o nounset
# set -o xtrace
newline=$'\n'
# ps %cpu is total consumption divided by total runtime, so we use
# the second iteration of top here to get a clean current value:
@kvz
kvz / papertrail-api.md
Created January 10, 2023 08:14
Papertrail API Coverage
  • log search API
    • events search
  • settings API
    • systems
      • list
      • show
      • register
      • update
  • remove
@kvz
kvz / un_checkbox.js
Created July 7, 2011 12:00
Uncheck 200+ boxes using chrome console on sites that neither support jquery nor have an 'unselect all' function :)
// In Chrome, right click => Inspect Element
// Goto the Console tab.
// Execute the following:
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(script);
$(':checkbox').prop('checked', false);
cd ~/code/uppy
git checkout main
git status
# make sure to have a clean working tree
git pull
yarn # you now have the node_modules from main, this includes the linting modules
git checkout $myBranch # e.g. `golden-retriever-ghosts-2`
git checkout main -- .eslintrc.js
git add .eslintrc.js
@kvz
kvz / Makefile
Last active August 28, 2021 14:35
The only Makefile for Node.js projects you'll ever need - https://twitter.com/kvz/status/685853830425231361
# Licensed under MIT.
# Copyright (2016) by Kevin van Zonneveld https://twitter.com/kvz
#
# This Makefile offers convience shortcuts into any Node.js project that utilizes npm scripts.
# It functions as a wrapper around the actual listed in `package.json`
# So instead of typing:
#
# $ npm script build:assets
#
# you could just as well type:
@kvz
kvz / unpacker.sh
Created March 1, 2011 10:28
Script that will unpack & cleanup fresh Synology Downloadstation files
#!/opt/bin/bash
# @todo: Don't delete parent dir if Dir == Root
# @todo: Root = $1 - But what about series!
set +x
export PATH="/opt/bin:/opt/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/syno/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/syno/bin:/usr/syno/sbin:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/syno/bin:/usr/syno/sbin:/usr/local/bin:/usr/local/sbin"
# Locking
LockFile="/volume1/downloads/nas_is_unpacking.lock"
if [ -f "${LockFile}" ]; then
@kvz
kvz / mac_apps_101_by_kvz.md
Created November 17, 2011 10:40
Mac Apps 101

kvz: "I'm recommending these Mac apps to a colleague who's losing his OSX virginity: https://gist.github.com/1372883. Anything you think I should add?"

Don't forget to look at the suggestions at the bottom, there's some cool stuff in there.

Essential

  • 1Password - password manager. intergrates with Dropbox & all main webbrowsers so you'll never lose a password again
  • Dropbox - a free 2GB folder in your homedir that stays in sync with all the devices you also install it on (linux/windows/mac/ipad/iphone/etc). Useful for backup, collaboration (share 1 folder with others), and keeping important documents with you.
  • Chrome - browsing
  • Colloquy - IRC
aa_DJ
aa_ER
aa_ET
af_ZA
agr_PE
ak_GH
am_ET
an_ES
anp_IN
ar_AE
<?php
// In PHP 5.4 you can pass JSON_UNESCAPED_UNICODE and JSON_UNESCAPED_SLASHES to json_encode:
$input = array('file' => '/\intro_cropsic – .m4v');
$paramsString = json_encode($input, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
// And that will encode arrays with unicode characters more compatible with JavaScript.
// (e.g. it will produce the same sha1 if you phpjs.utf8_encode paramString in JavaScript )
// On PHP 5.3 and lower, you may want to try
function json_encode_noescape_slashes_unicode ($arr) {
@kvz
kvz / resolving_dns_issues.txt
Created January 18, 2012 21:48
Amazon resolving DNS issues
root@cuc:~# grep nameserver /etc/resolv.conf
nameserver 172.16.0.23
root@cuc:~# time ssh git@github.com
ssh: Could not resolve hostname github.com: Temporary failure in name resolution
real 0m40.043s
user 0m0.000s
sys 0m0.008s