Skip to content

Instantly share code, notes, and snippets.

/**
* @return {boolean} true whether inside a node application or not.
**/
function isNode () {
try {
return "object" === typeof process && Object.prototype.toString.call(process) === "[object process]";
} catch(e) {}
return false;
}
@BeauBouchard
BeauBouchard / fixaudio.sh
Last active July 8, 2019 21:50
that ubuntu audio fix you keep forgetting
pulseaudio --kill
## removing config
rm --recursive ~/.config/pulse/*
rm --recursive ~/.pulse*
pulseaudio --kill
killall pulseaudio
## that beefy forced reload of alsa
apiVersion: v1
kind: Pod
metadata:
name: counter
spec:
containers:
- name: count
image: busybox
args: [/bin/sh, -c,
'i=0; while true; do echo "$i: $(date)"; i=$((i+1)); sleep 1; done']
@BeauBouchard
BeauBouchard / rooms.js
Created November 20, 2017 16:48
discover rooms for a given socket.io connection
function findRooms() {
var availableRooms = [];
var rooms = io.sockets.adapter.rooms;
if (rooms) {
for (var room in rooms) {
if (!rooms[room].hasOwnProperty(room)) {
availableRooms.push(room);
}
}
}
/**
* Sanitize Request variables
*/
public function sanitize($input) {
foreach ($input as $key => $value) {
if ($value) {
$input[$key] = filter_var($input[$key], FILTER_SANITIZE_STRING);
$input[$key] = preg_replace('/[^a-z0-9]/i', '', $input[$key]);
}
}
var str = 'class ಠ_ಠ extends Array {constructor(j = "a", ...c) {const q = (({u: e}) => {return { [`s${c}`]: Symbol(j) };})({});super(j, q, ...c);}}' +
'new Promise((f) => {const a = function* (){return "\u{20BB7}".match(/./u)[0].length === 2 || true;};for (let vre of a()) {' +
'const [uw, as, he, re] = [new Set(), new WeakSet(), new Map(), new WeakMap()];break;}f(new Proxy({}, {get: (han, h) => h in han ? han[h] ' +
': "42".repeat(0o10)}));}).then(bi => new ಠ_ಠ(bi.rd));';
try {
eval(str);
} catch(e) {
alert('Your browser does not support ES6!')
}
// masterlist = masterlist.sort((a,b) => a.value > b.value ? 1 : a.value < b.value ? -1 : 0 );
alias gc="git checkout"
alias gcb="git checkout -b"
alias gf="git fetch"
alias gp="git pull"
alias gs="git status"
alias gpo="git push origin"
alias addall="git add -A"
alias commitit="git commit -am"
alias pushit="git push origin head"
alias grc="git rebase --continue"
<p>
Morbi in nibh sit amet urna tincidunt cursus commodo sed urna. Nam tristique diam erat, et lacinia nunc lobortis id. Duis laoreet tortor arcu, sollicitudin molestie erat tempus non. Suspendisse eu facilisis erat, id maximus massa. Donec tincidunt rutrum enim, quis hendrerit tellus eleifend quis. Quisque condimentum malesuada lectus sit amet vulputate. Sed sagittis consequat quam, in ultricies tortor tristique eget.
</p>
<p>
<strong>Quote:</strong>
</p>
<blockquote>
Etiam rutrum odio nibh, in feugiat lectus sagittis quis. Phasellus suscipit porta ante, ac placerat nulla fringilla at.
</blockquote>
<p>
### Vice ASCII
echo " :#: :+##' ";
echo " ###### +#######. +###################:' ";
echo " '######## .##################, +##########################'. ";
echo " #####+ ############+ :########### :: .:############+";
echo " ####: #####'. ', ,####' ' .'######,";
echo " ###: ##: ##+ ;##+ ";
echo " ##, ;## ## ,## ;### ";
echo " '## ### +' #### ";
echo " ### ### '. + '###'''+##### ";