Skip to content

Instantly share code, notes, and snippets.

💭
wohoo!

Karl Pokus karlpokus

💭
wohoo!
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
karlpokus / stripexif.js
Created Aug 24, 2017
Strip EXIF from metadata from image file
View stripexif.js
// https://stackoverflow.com/questions/27638402/strip-exif-data-from-image
// includes fiddle
function removeExif(res, cb) {
const dv = new DataView(res);
let offset = 0;
let recess = 0;
const pieces = [];
let i = 0;
@karlpokus
karlpokus / vue_test.md
Created May 24, 2017
vue testing with tape
View vue_test.md

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
View unix_networking.md

netcat

Duplex between to terminals

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

Transfer files

@karlpokus
karlpokus / wp-on-do.md
Created May 15, 2017
wp on DO - setup
View wp-on-do.md

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
karlpokus / mongo_scale.md
Last active May 15, 2017
mongodb - maintenance, scaling, monitoring
View mongo_scale.md

Scale

  • replica sets scales reads
  • sharding scales read and writes

replica sets

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

primary member

@karlpokus
karlpokus / react_readme.md
Last active May 3, 2017
react for dummies
View react_readme.md

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
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
karlpokus / mysql.js
Last active Mar 2, 2017
mysql - api, node, security for dummies
View mysql.js
// pkg: mysql
// https://github.com/mysqljs/mysql#performing-queries
var mysql = require('mysql'),
connection = mysql.createConnection({
host:'localhost',
user:'bixa',
password:'pwd',
database:'foo'
});
@karlpokus
karlpokus / headless_pi.md
Created Feb 10, 2017
Setup raspberry pi 3 in headless mode
View headless_pi.md
You can’t perform that action at this time.