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 / .zshrc
Created October 8, 2021 11:26
ZSH vi cmd
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# vi mode
bindkey -v
(function() {
var AfterMethods, BeforeMethods, Middlewares, formatJsonWithPrefixAndColor, logAfterExecution, logBeforeExecution, processResult, removeInternalProperties, utils,
__slice = [].slice;
utils = Npm.require('util');
Middlewares = {};
BeforeMethods = {};

Keybase proof

I hereby claim:

  • I am jimmiehansson on github.
  • I am a610 (https://keybase.io/a610) on keybase.
  • I have a public key ASCewARCwMmxLOoNu7Ewc0xMqIv0XnaHlu5TWEaf6DK4tQo

To claim this, I am signing this object:

@jimmiehansson
jimmiehansson / jwt.js
Created August 1, 2019 08:09
jwt max byte
{
"type": "object",
"$schema": "[http://json-schema.org/draft-07/schema#](http://json-schema.org/draft-07/schema#)",
"properties": {
"iat": {
"title": "Issued at time",
"type": "string",
"description": "The issued at time.",
"maxLength": 20
},
### Keybase proof
I hereby claim:
* I am jimmiehansson on github.
* I am jimmiehansson (https://keybase.io/jimmiehansson) on keybase.
* I have a public key ASD7KCBcwKD7PgEIyr8uNSUC7FfEuQYQajIU2AI9-xBBmgo
To claim this, I am signing this object:
/**
* @description
*
* DOING: Should node modules and files required
* to separate them from the rest.
*/
const Sequelize = require('sequelize');
const SequelizeAutoBin = 'node_modules/sequelize-auto/bin/sequelize-auto';
const Joi = require('joi');

Add to your contaier config /etc/pve/lxc/XXX.conf:

lxc.apparmor.profile: unconfined
lxc.cgroup.devices.allow: a
lxc.cap.drop: 
lxc.mount.auto: proc:rw sys:rw

@jimmiehansson
jimmiehansson / benchmark.js
Created July 4, 2019 19:55
bench hashing algos
const Benchmark = require('benchmark')
const xxhash = require('xxhash')
const siphash = require('siphash')
const fnv1a = require('@sindresorhus/fnv1a')
const { createHash } = require('crypto')
var suite = new Benchmark.Suite
const config_ = {
SECRET: 'This is a secret key',
@jimmiehansson
jimmiehansson / index.js
Created July 4, 2019 14:57
Etag non secure hash
'use strict'
const fp = require('fastify-plugin')
function hash (A) {
if (!A) return void 0
var bin_
var buf_
var b64_
@jimmiehansson
jimmiehansson / index.js
Created July 4, 2019 12:25
Etag rand without added seed and less collision
'use strict'
const fp = require('fastify-plugin')
function hash (timestamp) {
if (!timestamp) return void 0
var buf_
var b64_