Skip to content

Instantly share code, notes, and snippets.

View doomhz's full-sized avatar

Dumitru Glavan doomhz

View GitHub Profile
@papnkukn
papnkukn / download.js
Last active December 4, 2023 16:35
Backup Gmail / Download all Gmail e-mail messages using REST API and Node.js
const fs = require('fs');
const path = require('path');
const readline = require('readline');
const {google} = require('googleapis');
const SCOPES = ['https://www.googleapis.com/auth/gmail.readonly'];
const TOKEN_PATH = 'token.json';
const OUTPUT_FOLDER = './output';
const METADATA_FILE = 'metadata.json';
@perry-mitchell
perry-mitchell / encryption-example.js
Last active February 27, 2022 09:55
Encryption and decryption using AES CBC in NodeJS, with key derivation
const { pbkdf2: deriveKey } = require("pbkdf2");
const crypto = require("crypto");
const DERIVATION_ROUNDS = 200000;
const HMAC_KEY_SIZE = 32;
const PASSWORD_KEY_SIZE = 32;
function pbkdf2(password, salt, rounds, bits) {
return new Promise((resolve, reject) => {
deriveKey(password, salt, rounds, bits / 8, "sha256", (err, key) => {
@sebmor
sebmor / gist:e32629f2c9f26cb7c9ff7356d349e27a
Last active November 9, 2018 03:41
Open Ethereum Wallet
import bip39 from 'bip39'
import hdkey from 'ethereumjs-wallet/hdkey'
import uuid from 'uuid'
import SHA256 from 'crypto-js/sha256'
import pbkdf2 from 'pbkdf2'
const SHARED_SALT = 'MaWe^C?2uButtKymBeRw5z*h3Z^x6LN*Bcj%d9xh@rkBFfA5X+#dwd5SRraYPY&2vjP_s*w$kd*!en7-%td&?R+zgtpHGLeBrSnh=-J#Fj=qpg%GwSpA=H83bG53sjmNBNe-DR6NDVXe@SJgps!-zx2^FFEk*DWsqYPg&edC3rR9n%$M*h2W+6*ADwc$Hpj*bESS?aV!&S8xnJ%%Z6jeFCBnHsXANVC2ZjD%8C3*P5e=CWn+x8Y?8CKJA3@fF6*=e8!L5$BWSBNQ2B3ECYbJ4-EkTE=!4#5nhPb5sw#3N4bCQDcGt7_QEE4xYpYz6EvJF9?5BD7bwwV7?kS9B6RRXBe3WYFwuG88yr$#JHb=?*vfMe=F+8rkTxNY2T^RyE4BFaDQenaj?$XHgafsRU#n!XnD3ageyWEMjSu&vPa9yy!$XCBFURfL#G9!u@B^5U%ZJx9$Gm6P5jjfAkZ=U@JqUq^YPY74DTbZaxjMRgVJ&$$q_v?r@fKsvJfSJp3fGYGq'
export function openWallet(walletid = uuid(), password) {
console.time('timetodecrypt')
@estorgio
estorgio / Mounting VirtualBox shared folders on Ubuntu Server 16.04 LTS.md
Last active June 19, 2024 15:50
Mounting VirtualBox shared folders on Ubuntu Server 16.04 LTS

Update 28 July 2019: An updated version of this guide for Ubuntu Server 18.04 LTS is now available. Feel free to check it out.

Update 23 May 2020: This guide is ALREADY OUTDATED and might no longer work with new versions of Ubuntu and VirtualBox. Please consider switching to the updated guide instead. I will no longer respond to the replies to this gist. Thank you.

Mounting VirtualBox shared folders on Ubuntu Server 16.04 LTS

This guide will walk you through steps on how to setup a VirtualBox shared folder inside your Ubuntu Server guest. Tested on Ubuntu Server 16.04.3 LTS (Xenial Xerus)

If you find the following useful my donation address is: aEgoFC75sP78gT55em1QYcL8DNYZ78ewJ5
1. Go here: https://console.aws.amazon.com/ec2sp/v1/spot/home?region=us-east-1
2. Click: "Request Spot Instances"
3. Request type: "Request and Maintain"
4. Choose how ever many servers/vcpus you want in the "Target Capacity" section.
@atoponce
atoponce / gist:07d8d4c833873be2f68c34f9afc5a78a
Last active July 26, 2024 09:10 — forked from tqbf/gist:be58d2d39690c3b366ad
Cryptographic Best Practices

Cryptographic Best Practices

Putting cryptographic primitives together is a lot like putting a jigsaw puzzle together, where all the pieces are cut exactly the same way, but there is only one correct solution. Thankfully, there are some projects out there that are working hard to make sure developers are getting it right.

The following advice comes from years of research from leading security researchers, developers, and cryptographers. This Gist was [forked from Thomas Ptacek's Gist][1] to be more readable. Additions have been added from

@yefim
yefim / Dockerrun.aws.json
Last active April 7, 2023 16:11
Build a Docker image, push it to AWS EC2 Container Registry, then deploy it to AWS Elastic Beanstalk
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "<AWS_ACCOUNT_ID>.dkr.ecr.us-east-1.amazonaws.com/<NAME>:<TAG>",
"Update": "true"
},
"Ports": [
{
"ContainerPort": "443"
}
@johnpolacek
johnpolacek / .gitconfig
Last active July 9, 2024 12:14
My current .gitconfig aliases
[alias]
co = checkout
cob = checkout -b
coo = !git fetch && git checkout
br = branch
brd = branch -d
brD = branch -D
merged = branch --merged
st = status
aa = add -A .
@bensmithett
bensmithett / AppComponent.cjsx
Last active April 20, 2020 06:59
The world's tiniest guide to getting started with React, JSX, CoffeeScript & Webpack
React = require("react")
VideoPlayerComponent = require("components/VideoPlayerComponent")
AppComponent = React.createClass
# Need to add this manually if you want it to show up in React Chrome Dev Tools
# See https://github.com/jsdf/coffee-react-transform/issues/16
displayName: "AppComponent"
render: ->
<div>
@LeCoupa
LeCoupa / nodejs-cheatsheet.js
Last active June 30, 2024 04:14
Complete Node.js CheatSheet --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
/* *******************************************************************************************
* THE UPDATED VERSION IS AVAILABLE AT
* https://github.com/LeCoupa/awesome-cheatsheets
* ******************************************************************************************* */
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html