Skip to content

Instantly share code, notes, and snippets.

@wesleybliss
wesleybliss / security.js
Created December 7, 2017 21:32
Bcrypt helpers for hashing passwords
'use strict'
const bcrypt = require('bcrypt')
const BCRYPT_SALT_ROUNDS = 10
/**
* Creates a hash of a string using default bcrypt config
*
* @param {String} password Password or any string to be hashed
@wesleybliss
wesleybliss / fedora-restore-packages
Created May 3, 2017 21:03
Restores repos + apps on RPM based distros
#!/bin/bash
BASE="~/Dropbox/fedora-backups/installed-software-list"
echo
echo "Are you sure you want to restore DNF repos/configs, and install all packages?"
echo
echo "You should make a backup first!"
echo
@wesleybliss
wesleybliss / fedora-backup-packages
Created May 3, 2017 21:02
Backup repo sources + apps list on RPM based distros
#!/bin/bash
BASE="~/Dropbox/fedora-backups/installed-software-list"
# Backup sources
/bin/cp -LRf /etc/yum.repos.d/* "$BASE/etc_yum.repos.d/"
# Backup packages list
rpm -qa --qf "%{NAME}\n" | sort > "$BASE/dnf-installed-packages.log"
@wesleybliss
wesleybliss / docker-compose-node-mongo.yml
Created September 9, 2016 21:37
Docker Compose with example App & Mongo
version: '2'
services:
myapp:
build: .
container_name: "myapp"
image: debian/latest
environment:
- NODE_ENV=development
- FOO=bar
volumes:
@carcinocron
carcinocron / debugger pause beforeunload
Last active April 14, 2025 17:13
Chrome: pause before redirect
// Run this in the F12 javascript console in chrome
// if a redirect happens, the page will pause
// this helps because chrome's network tab's
// "preserve log" seems to technically preserve the log
// but you can't actually LOOK at it...
// also the "replay xhr" feature does not work after reload
// even if you "preserve log".
window.addEventListener("beforeunload", function() { debugger; }, false)
@mig
mig / gnome-reset.sh
Created July 10, 2013 17:07
Reset Gnome 3 config to default
rm -rf .gnome .gnome2 .gconf .gconfd .metacity .cache .dbus .dmrc .mission-control .thumbnails ~/.config/dconf/user ~.compiz*
@webdesserts
webdesserts / Gulpfile.js
Last active April 3, 2023 08:16
Automatically reload your node.js app on file change with Gulp (https://github.com/wearefractal/gulp).
// NOTE: I previously suggested doing this through Grunt, but had plenty of problems with
// my set up. Grunt did some weird things with scope, and I ended up using nodemon. This
// setup is now using Gulp. It works exactly how I expect it to and is WAY more concise.
var gulp = require('gulp'),
spawn = require('child_process').spawn,
node;
/**
* $ gulp server
* description: launch the server. If there's a server already running, kill it.