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 / npm_link.md
Last active July 13, 2022 15:32
npm link for dummies
@karlpokus
karlpokus / ts.md
Last active July 1, 2018 00:10
nodeJS - file ts - time created, modified
@karlpokus
karlpokus / gas.js
Last active May 24, 2018 13:36
google sheets API
// count by regex
COUNTIF(range, "F1*")
// countif more/less
COUNTIF(range, ">2015-01-01")
// countif NOT
COUNTIF(range, "<>Läkare")
// url - google sheets regex syntax
@karlpokus
karlpokus / cloud9.md
Last active September 7, 2017 06:42
cloud 9 - free disk space from heroku cache

OUT OF DISK SPACE

It seems heroku caches lots of node modules in /home/ubuntu/.local/share/heroku/tmp. Just empty this dir and you'll be fine.

# in /home/ubuntu/.local/share/heroku
$ rm -rf tmp/*
# check
$ du -sh *
@karlpokus
karlpokus / stripexif.js
Created August 24, 2017 07:34
Strip EXIF from metadata from image file
// 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 09:25
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
@karlpokus
karlpokus / unix_networking.md
Created May 22, 2017 10:49
unix networking

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 15:57
wp on DO - setup

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 15:23
mongodb - maintenance, scaling, monitoring

Scale

  • replica sets scales reads
  • sharding scales read and writes

replica sets

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

primary member