Skip to content

Instantly share code, notes, and snippets.


Karl Pokus karlpokus

Block or report user

Report or block karlpokus

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
karlpokus / stripexif.js
Created Aug 24, 2017
Strip EXIF from metadata from image file
View stripexif.js
// includes fiddle
function removeExif(res, cb) {
const dv = new DataView(res);
let offset = 0;
let recess = 0;
const pieces = [];
let i = 0;
karlpokus /
Created May 24, 2017
vue testing with tape

How to convert a SFC to something I can require?

  • bundle.js does not work
  • need to compile each part of the SFC individually

vue loader

  • vue loader vue-loader is a loader for Webpack that can transform Vue components written in the following format into a plain JavaScript module vue-loader will parse the file, extract each language block, pipe them through other loaders if necessary, and finally assemble them back into a CommonJS module whose module.exports is a Vue.js component options object.
  • vue loader configs


Duplex between to terminals

# start
$ nc -l 1234
# listen
$ nc 1234

Transfer files

karlpokus /
Created May 15, 2017
wp on DO - setup


  • one-click install
  • sensitive file: wp-config.php
  • new db user, OS user, wp user
  • add ssh keys && Disable Password Authentication
  • do mysql_secure_installation
  • wp REST api
  • http://ip/wp-login.php
  • dir: /var/www/html
  • The "ufw" firewall is enabled. All ports except for 22, 80, and 443 are BLOCKED.
karlpokus /
Last active May 15, 2017
mongodb - maintenance, scaling, monitoring


  • replica sets scales reads
  • sharding scales read and writes

replica sets

  • backup
  • primary and secondary members
  • oplog requires a replica set

primary member

karlpokus /
Last active May 3, 2017
react for dummies

react for dummies

  • docs
  • JSX produces React "elements" via React.createElement()
  • wrap JSX in parens to get multiple lines
  • element != component
  • ok to have multiple root nodes
  • React elements are immutable
  • components are like functions. They accept arbitrary inputs (called "props") and return React elements describing what should appear on the screen.

Functional and Class Components

karlpokus / upload_compat.js
Last active Mar 21, 2017
client file upload - closure and promises
View upload_compat.js
// assume <input id="files" type="file" multiple/>
var files = document.getElementById('files');
files.addEventListener('change', processFiles, false);
function processFiles() {
readFiles(this.files, upload);
function readFiles(files, cb) {
var payloads = [];
karlpokus / mysql.js
Last active Mar 2, 2017
mysql - api, node, security for dummies
View mysql.js
// pkg: mysql
var mysql = require('mysql'),
connection = mysql.createConnection({
karlpokus /
Created Feb 10, 2017
Setup raspberry pi 3 in headless mode
You can’t perform that action at this time.