Skip to content

Instantly share code, notes, and snippets.

@siwalikm
siwalikm / aes-256-cbc.js
Last active April 26, 2024 12:34
AES-256-CBC implementation in nodeJS with built-in Crypto library
'use strict';
const crypto = require('crypto');
const ENC_KEY = "bf3c199c2470cb477d907b1e0917c17b"; // set random encryption key
const IV = "5183666c72eec9e4"; // set random initialisation vector
// ENC_KEY and IV can be generated as crypto.randomBytes(32).toString('hex');
const phrase = "who let the dogs out";
var encrypt = ((val) => {
@JonAbrams
JonAbrams / gist:7edaa3545f8fd11a1919
Created July 9, 2015 23:15
How to add getter/setter methods to ES6 classes after the class is created
// Also works for normal methods
class User {
constructor (first, last) {
this.firstName = first;
this.lastName = last;
}
}
Object.defineProperty(User.prototype, 'name', {
get: function () {
@ifguido
ifguido / S3.js
Last active April 26, 2024 12:29
Get file from S3 and download
const AWS = require("aws-sdk");
const s3 = new AWS.S3({
accessKeyId: sails.config.custom.S3key,
secretAccessKey: sails.config.custom.S3secret,
});
function getObjectAsync(params) {
return new Promise((resolve, reject) => {
@laurentperroteau
laurentperroteau / GIT.md
Last active April 26, 2024 12:29
Liste de commande GIT

Git

Lexique :

  • HEAD : la révision courante (normalement le dernier commit)
  • untracked : pas encore versionné
  • unmodified : versionné mais pas modifié
  • modified : ayant des modifications pas encore ajouté au repo local
  • staged : sur le repo local
  • fast-forward (ou ff) : explication
@raveren
raveren / AIO.ahk
Last active April 26, 2024 12:29
My personal autohotkey configuration (used and updated for 10+ years!)
;
; ██╗███╗ ██╗██╗████████╗██╗ █████╗ ██╗ ██╗███████╗███████╗
; ██║████╗ ██║██║╚══██╔══╝██║██╔══██╗██║ ██║╚══███╔╝██╔════╝
; ██║██╔██╗ ██║██║ ██║ ██║███████║██║ ██║ ███╔╝ █████╗
; ██║██║╚██╗██║██║ ██║ ██║██╔══██║██║ ██║ ███╔╝ ██╔══╝
; ██║██║ ╚████║██║ ██║ ██║██║ ██║███████╗██║███████╗███████╗
; ╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝╚══════╝╚══════╝
;
; https://gist.github.com/raveren/bac5196d2063665d2154/edit
;
@tVienonen
tVienonen / Bluetooth LE Dual Boot Connecting guide.md
Created February 23, 2020 17:24
Guide for pairing and connecting Bluetooth LE devices when using Linux and Windows dual boot

Bluetooth LE Dual Boot Connecting guide

  1. Pair and connect on Linux
  2. Pair and connect on Windows
  3. Shut down Bluetooth device
  4. Boot to Linux
  5. Mount Windows partition
  6. Go to <windows-mount>/Windows/System32/config
  7. Run command chntpw -e SYSTEM
  • Install chntpw if it is not available
@kizzx2
kizzx2 / docker-compose.yml
Last active April 26, 2024 12:22
Restart a docker container periodically with docker-compose
version: '3'
services:
app:
image: nginx:alpine
ports: ["80:80"]
restart: unless-stopped
restarter:
image: docker:cli
volumes: ["/var/run/docker.sock:/var/run/docker.sock"]
@JohannesMP
JohannesMP / EnableDiscordDevExperiments.md
Last active April 26, 2024 12:21 — forked from ExordiumX/betaenabler.js
Enabling Discord Dev Experiments on Discord for Windows (2022-02)

Enable Dev Experiments in Discord for Windows

image

This guide shows how to enable dev mode for the Discord desktop application running on Windows (as of February 2022).

This can be used to view beta experiments to try features currently in development that are included but hidden by default in Discord release builds.


@nullchilly
nullchilly / coc-pylance.md
Last active April 26, 2024 12:20
Add pylance to coc.nvim

Install the pylance extension in vscode or manually download it from the marketplace

The extension path should be similar to this: ~/.vscode/extensions/ms-python.vscode-pylance-2023.11.10

In init.vim, this will automatically detect the latest pylance version because after an upgrade the old plugin might linger for a while:

call coc#config('languageserver', { "pylance": { "module": expand("~/.vscode/extensions/ms-python.vscode-pylance-*/dist/server.bundle.js", 0, 1)[0] } })