Skip to content

Instantly share code, notes, and snippets.

View jimmiehansson's full-sized avatar
🇸🇪
Breaking things to improve them

Jimmie Hansson jimmiehansson

🇸🇪
Breaking things to improve them
View GitHub Profile
@jimmiehansson
jimmiehansson / ignore.js
Created December 3, 2018 15:57
example
// quick example
function expectedLogSuffix (expression = { str: '', encounters: 2 }) {
var { str, encounters } = expression
if (str === null || str.length === 0 || typeof str !== 'string') {
return undefined
}
var trim = str.split(' ').filter(n => n.match(/^[A-Z]{4}s*/))
return trim.length === encounters
}
@jimmiehansson
jimmiehansson / openvpn-debian-nordvpn.md
Created July 30, 2018 16:06
Setting OpenVPN on Debian (NordVPN as provider)

Setting OpenVPN on Debian (NordVPN as provider)

Tested on Debian 9.

First, edit /etc/default/openvpn and uncomment the following setting to prevent any VPN from being launched automatically:

AUTOSTART="none"
@jimmiehansson
jimmiehansson / .gitconfig
Created April 17, 2018 13:56
git config
[alias]
# View abbreviated SHA, description, and history graph of the latest 20 commits
l = log --pretty=oneline -n 20 --graph --abbrev-commit
# View the current working tree status using the short format
s = status -s
# Show the diff between the latest commit and the current state
d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat"
@jimmiehansson
jimmiehansson / sysctl.conf
Created April 10, 2018 21:23
System optimized (sysctl.conf) for Nginx 4-2
#
# /etc/sysctl.conf - Configuration file for setting system variables
# See /etc/sysctl.d/ for additional system variables.
# See sysctl.conf (5) for information.
#
#kernel.domainname = example.com
# Uncomment the following to stop low-level messages on console
#kernel.printk = 3 4 1 3
> @pp/pp-nm-module-template@1.0.0 example /Users/jimmiehansson/github/pp/pr/pp-nm-accounts
> NODE_ENV=test node example.js
sequelize deprecated String based operators are now deprecated. Please use Symbol based operators for better security, read more at http://docs.sequelizejs.com/manual/tutorial/querying.html#operators node_modules/sequelize/lib/sequelize.js:242:13
Executing (c2844de3-0e01-46c6-9cc1-ab217f28fe82): START TRANSACTION;
Executing (default): SELECT "pk_accounts_id", "email", "username", "timestamp_created", "timestamp_modified", "password_hash", "vector_token", "domains_id", "subscription_token" FROM "consumers"."accounts" AS "accounts" WHERE "accounts"."username" = 'test' LIMIT 1;
Executing (c2844de3-0e01-46c6-9cc1-ab217f28fe82): COMMIT;
accounts {
dataValues:
{ pk_accounts_id: 1,
@jimmiehansson
jimmiehansson / sync_gdrive.py
Created March 19, 2018 09:36 — forked from markuscraig/sync_gdrive.py
Rclone + Google Drive sync script
#!/usr/bin/env python
import os
import shutil
import subprocess
# global variables
SYNC_DIRS = [
{
'src': "/Volumes/PhotoArchive/Lightroom",
@jimmiehansson
jimmiehansson / vzdump-hook-script.pl
Created March 18, 2018 20:44
Perl script that uploads backup files to cloud storage using rclone, removes backups older then 1 week.
#!/usr/bin/perl -w
# example hook script for vzdump (--script option)
use strict;
print "HOOK: " . join (' ', @ARGV) . "\n";
my $phase = shift;
'use strict';
/**
* This notation was generated by templates.
* // -------------------------------------------------
* @description Universal database factory
* @file index.js
* @author: Anton Myrberg <anton> 2018-02-26T11:10:55+01:00
* // -------------------------------------------------
* Make sure this file is part of its proper namespace
@jimmiehansson
jimmiehansson / env.js
Created February 22, 2018 19:20
Backoffice ENV
'use strict';
const fs = require('fs');
const path = require('path');
const paths = require('./paths');
// Make sure that including paths.js after env.js will read .env variables.
delete require.cache[require.resolve('./paths')];
const NODE_ENV = process.env.NODE_ENV;
@jimmiehansson
jimmiehansson / sample.js
Created February 13, 2018 16:53
Example of a simple functional file
'use strict';
/**
* This notation was generated by templates.
* // -------------------------------------------------
* GLOBAL FILE NOTATIONS
* Project of: Rocketdesk Auth
* Filename: Connector.js by jimmie
* Created: 2017-07-17 @ 23:00