Skip to content

Instantly share code, notes, and snippets.

View gist:a461804f15de0b4420460d645c41095f
### Keybase proof
I hereby claim:
* I am receptor on github.
* I am sebp (https://keybase.io/sebp) on keybase.
* I have a public key ASBlTt0ie4yELLDigD6AcIH-B-AqIIlEONlZEZ2MnwRp4Qo
To claim this, I am signing this object:
@receptor
receptor / http2redis.ts
Created Mar 20, 2019
Publish HTTP request to Redis channel
View http2redis.ts
process.on("SIGINT", () => process.exit());
import * as bodyParser from "body-parser";
import express from "express";
import redis from "redis";
// logger
const now = () => new Date().toISOString();
const loggerFacility = console;
const logger = {
View gist:f7dce35373de4305347620e11c6a34b2
brew install ffmpeg
cd /path/to/flac
for i in *.flac; do ffmpeg -i "$i" -vn -c:a alac "$(basename "$i" .flac).m4a"; done;
@receptor
receptor / gist:c9e53d255877758ce510c4899a986a33
Created Nov 23, 2018
OpenSSL encrypt & decrypt one-liners
View gist:c9e53d255877758ce510c4899a986a33
ENCRYPT
$ echo "my secret message" | openssl aes-256-cbc -a -salt
enter aes-256-cbc encryption password:
Verifying - enter aes-256-cbc encryption password:
U2FsdGVkX19T5h74/9HOtWBX4WoIggVKksYf7L1WBso=
DECRYPT
$ echo "U2FsdGVkX19T5h74/9HOtWBX4WoIggVKksYf7L1WBso=" | openssl aes-256-cbc -a -d -salt
enter aes-256-cbc decryption password:
my secret message
View gist:aae01bcee009806c66b5b6ecfe1e39de
### Keybase proof
I hereby claim:
* I am receptor on github.
* I am sebp (https://keybase.io/sebp) on keybase.
* I have a public key ASBlTt0ie4yELLDigD6AcIH-B-AqIIlEONlZEZ2MnwRp4Qo
To claim this, I am signing this object:
View learn-git-the-hard-way.txt
1) Reference
Many will know this already, but I need to make sure you know it because it’s so fundamental.
A ‘reference’ is a string that points to a commit.
There are four main types of reference: HEAD, Tag, Branch, and Remote Reference.
HEAD
HEAD is a special reference that always points to where the git repository is.
If you checked out a branch, it’s pointed to the last commit in that branch.
@receptor
receptor / jsclone.js
Last active Feb 2, 2018
javascript clone
View jsclone.js
// usage
// const obj = /* ... */;
// const sc = await jsclone.structuralClone(obj);
// const c = jsclone.clone(obj);
moudule.exports = {
structuralClone(obj) => {
return new Promise(resolve => {
const {port1, port2} = new MessageChannel();
@receptor
receptor / nopetyavac.bat
Last active Jun 29, 2017
Vaccination for Petya ransomware
View nopetyavac.bat
@echo off
REM Administrative check from here: https://stackoverflow.com/questions/4051883/batch-script-how-to-check-for-admin-rights
REM Vaccination discovered by twitter.com/0xAmit
REM Batch file created by Lawrence Abrams of BleepingComputer.com. @bleepincomputer @lawrenceabrams
echo Administrative permissions required. Detecting permissions...
echo.
net session >nul 2>&1
@receptor
receptor / ConsoleLog.js
Created Jan 27, 2017
console.log wrapper
View ConsoleLog.js
// Full version of `log` that:
// * Prevents errors on console methods when no console present.
// * Exposes a global 'log' function that preserves line numbering and formatting.
(function () {
var method;
var noop = function () { };
var methods = [
'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
@receptor
receptor / EscapeHtml.js
Created Jan 27, 2017
Cross-browser safe and fast HTML sanitizer
View EscapeHtml.js
// Use the browser's built-in functionality to quickly and safely escape the string
function escapeHtml(str)
{
var div = document.createElement('div')
div.appendChild(document.createTextNode(str))
return div.innerHTML
}
// UNSAFE with unsafe strings; only use on previously-escaped ones!
function unescapeHtml(escapedStr)