Skip to content

Instantly share code, notes, and snippets.

@vlucas
vlucas / encryption.ts
Last active April 26, 2025 10:26
Stronger Encryption and Decryption in Node.js
import { createCipheriv, createDecipheriv, randomBytes } from "crypto";
const ENCRYPTION_KEY: string = process.env.ENCRYPTION_KEY || ""; // Must be 256 bits (32 characters)
const IV_LENGTH: number = 16; // For AES, this is always 16
/**
* Will generate valid encryption keys for use
* Not used in the code below, but generate one and store it in ENV for your own purposes
*/
export function keyGen() {
#!/bin/sh
ovs_dir_conf="/usr/local/etc/openvswitch"
ovs_file_conf_db="${ovs_dir_conf}/conf.db"
ovs_file_schema="vswitchd/vswitch.ovsschema"
#ovs_file_schema="${ovs_dir_conf}/vswitch.ovsschema"
ovs_file_var="/usr/local/var/run/openvswitch"
start()
@kerryboyko
kerryboyko / README.md
Last active April 26, 2023 16:08
VueJS Best Practices Guide

Deverus Vue.js Style Guide

Guide for developing Vue.js applications.

v. 0.0.1

Vue.js is an amazing framework, which can be as powerful as Angular or React, the two big heavy hitters in the world of front-end frameworks.

However, most of Vue's ease-of-use is due to the use of Observables - a pattern that triggers re-renders and other function calls with the reassignment of a variable.

@elit8888
elit8888 / res_adjust.md
Last active February 1, 2024 23:16
Use keyboard shortcut to adjust resolution higher or lower in MacOS

Resolution Adjustment Shortcut Setup

This note illustrates how to adjust resolution using keyboard shorcut using built-in app automator. After setting up, I can use two actions:

  • Switch to Highest resolution
  • Switch to Default resolution

I'm new to apple script, so the rule is very simple.

References:

@hisplan
hisplan / add-rsync-to-git-bash.md
Created February 21, 2018 09:02
Add rsync to git bash for windows
@rightson
rightson / ubuntu-mate-18.04-provisioning.sh
Last active July 10, 2018 02:37
My quick provisioning script for Ubuntu MATE 18.04
echo 'Adding repository of sierra theme ...'
sudo add-apt-repository ppa:dyatlov-igor/sierra-theme -y
echo 'Adding repository of spotify ...'
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0DF731E45CE24F27EEEB1450EFDC8610341D9410 931FF8E79F0876134EDDBDCCA87FF9DF48BF1C90
echo deb http://repository.spotify.com stable non-free | sudo tee /etc/apt/sources.list.d/spotify.list
echo 'Updating apt ...'
sudo apt update
@rightson
rightson / register-gitea-as-service.bat
Last active July 10, 2018 02:36
Register gitea as a windows service
rem Register command
sc create Gitea start= auto binPath= ""D:\Applications\gitea\gitea.exe" web --config "D:\Applications\gitea\my-app.ini""
rem De-register command
sc delete Gitea
@rightson
rightson / vue.config.js
Created August 7, 2018 08:03
vuel-cli 3.x proxy setting (different from 2.x's proxyTable setting)
module.exports = {
devServer: {
proxy: {
'/api': {
target: 'http://localhost:8000/api',
changeOrigin: true,
ws: true,
pathRewrite: {
'^/api': ''
}
@rightson
rightson / sslvpn.sh
Last active October 24, 2018 13:39
Pulse Secure Client Wrapper for Ubuntu (for Pulse-Secure-8.2R5) with simple usename/hostname cache
#!/bin/bash
CLIENT=/usr/local/pulse/PulseClient.sh
CONFIG=~/.sslvpn.conf
function usage() {
echo -e "Usage: `basename $0` <options>\noptions:"
grep "^function" $0 | sed 's/function/ /g' | sed 's/[{()]//g'
}
@rightson
rightson / router.sh
Last active October 25, 2018 07:43
A helper for simplifying and remembering the add/route default gateway commands
#!/bin/bash
CONFIG=~/.route.conf
function usage() {
echo -e "Usage: `basename $0` <options>\noptions:"
grep "^function" $0 | sed 's/function/ /g' | sed 's/[{()]//g'
}
function list() {