Skip to content

Instantly share code, notes, and snippets.

View karlpokus's full-sized avatar
💭
wohoo!

carl-fredrik grimberg karlpokus

💭
wohoo!
View GitHub Profile
@karlpokus
karlpokus / phishing_test.md
Created September 9, 2016 07:20
phishing test @Company - implementation details

Inspired by this -> https://insight.duo.com/

Simple usage

  1. get a list of e-mail addresses
  2. send e-mails with personal URL from hashed e-mail address
  3. log each requests (ts, url, user) on server

result

  • e-mail addresses of personel who clicked the link
  • % personel who clicked
@karlpokus
karlpokus / bash_boss.sh
Last active February 20, 2017 16:41
bash like a baos!
# cd from ls
cd `ls | grep bengt`
# ls by mtime
ls -t
# page through a file
less filename
# processes
top
ps -aux
# write file
@karlpokus
karlpokus / encoder.md
Created September 13, 2016 14:22
encode urls in js. Safe characters and what-not.

encode URLs

src

TL;DR

  • encodeURI() will not encode ~!@#$&*()=:/,;?+' Use on entire string
  • encodeURIComponent() will not encode: ~!*()' Use on tricky values. Will ruin = and &
@karlpokus
karlpokus / url.md
Last active October 13, 2016 12:59
URL parts for dummies
@karlpokus
karlpokus / piping.md
Last active September 27, 2016 08:37
Piping is fun! Maybe control flow is a more suitable title but who cares?

Piping is fun!

unix

$ ls | grep test

ExpressJS

app.get('/', fn1, fn2, fn3); // or pass an array
@karlpokus
karlpokus / mute.md
Created September 27, 2016 16:05
console.mute @uppsalaJS 2016-09-27

console.mute

usage

  • readme

how does it work?

  • node api - console
  • console.js

some tests

@karlpokus
karlpokus / ts.md
Last active July 1, 2018 00:10
nodeJS - file ts - time created, modified
@karlpokus
karlpokus / uuid.js
Last active October 20, 2016 09:11
Create unique id in js
// http://stackoverflow.com/a/2117523/1983554
function createId() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
.replace(/[xy]/g, function(c) {
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
return v.toString(16);
});
}
@karlpokus
karlpokus / secretary.js
Created October 20, 2016 09:35
n people take turns taking notes at the weekly meeting @Company. Whose turn is it week x?
function secretary(people, weekNumber){
var index = weekNumber % people.length;
return people[index];
}