Skip to content

Instantly share code, notes, and snippets.

View mmmpop's full-sized avatar
🏠
Working from home

Mike Poplin mmmpop

🏠
Working from home
View GitHub Profile
@sr75
sr75 / wildcard-ssl-cert-for-testing-nginx-conf.md
Created June 1, 2013 18:35
create a self signed wildcard ssl cert for testing with nginx.conf example

just change out app_name for your purposes

openssl genrsa 2048 > app_name-wildcard.key

openssl req -new -x509 -nodes -sha1 -days 3650 -key app_name-wildcard.key > app_name-wildcard.cert

# Common Name (eg, your name or your server's hostname) []:*.app_name.com

openssl x509 -noout -fingerprint -text < app_name-wildcard.cert > app_name-wildcard.info
# Change prefix key to Ctrl+a
unbind C-b
set -g prefix C-a
# Last active window
unbind l
bind C-a last-window
# More straight forward key bindings for splitting
unbind %
@mgedmin
mgedmin / StartSSL.md
Last active October 22, 2023 07:52
Free StartSSL.com SSL certificate HOWTO

How to get a free StartSSL.com SSL certificate

I'm writing this up from memory, so errors may appear.

This has been updated to use SHA256 certificates.

Start

  1. Go to http://www.startssl.com/
  2. Click on 'Control Panel'
@branneman
branneman / better-nodejs-require-paths.md
Last active April 8, 2024 00:22
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

// Setting up an IRC server on Cent 6
// Create a user and group for this guy
$ groupadd ircadmin && useradd -m -g ircadmin -s /bin/bash ircadmin
// Make a working directory (/var/source/)
mkdir source && cd source
// Grab the latest versions of Anope and UnrealIRCd
$ wget http://www.unrealircd.com/downloads/Unreal3.2.9.tar.gz http://downloads.sourceforge.net/project/anope/anope-stable/Anope%201.8.7/anope-1.8.7.tar.gz
@vadviktor
vadviktor / base64.sql
Created March 11, 2014 14:40
Legacy MySQL (v 5.1) BASE64 functions
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for base64_data
-- ----------------------------
DROP TABLE IF EXISTS `base64_data`;
CREATE TABLE `base64_data` (
`c` char(1) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`val` tinyint(4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active February 12, 2024 17:18
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@anandsunderraman
anandsunderraman / setChromeOptions.js
Last active February 21, 2023 01:07
Selenium Web Driver Set Chrome Options
//import the selenium web driver
var webdriver = require('selenium-webdriver');
var chromeCapabilities = webdriver.Capabilities.chrome();
//setting chrome options to start the browser fully maximized
var chromeOptions = {
'args': ['--test-type', '--start-maximized']
};
chromeCapabilities.set('chromeOptions', chromeOptions);
var driver = new webdriver.Builder().withCapabilities(chromeCapabilities).build();
@mefellows
mefellows / Vagrantfile
Created December 7, 2014 21:24
Example Vagrant Windows SMB Setup
VAGRANTFILE_API_VERSION = "2"
require 'io/console'
# Capture login details if starting up vagrant or provisioning it
# Required for AD operations.
#
# Environment variables prevent explicit user input. Useful for CI.
username = ENV["VAGRANT_USER"] || nil
password = ENV["VAGRANT_PASSWORD"] || nil
@nolanlawson
nolanlawson / protips.js
Last active February 4, 2024 18:06
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");