Skip to content

Instantly share code, notes, and snippets.

View neonexus's full-sized avatar

NeoNexus DeMortis neonexus

  • USA
  • 05:44 (UTC -05:00)
View GitHub Profile
@neonexus
neonexus / state-pulldown.html.twig
Created August 7, 2014 20:41
Twig include file for state pulldown
{% set states = {
AL: 'Alaska',
AZ: 'Arizona',
AR: 'Arkansas',
CA: 'California',
CO: 'Colorado',
CT: 'Connecticut',
DE: 'Delaware',
DC: 'District of Columbia',
FL: 'Florida',
@neonexus
neonexus / pem login.md
Last active August 29, 2015 14:13
Generate PEM login

cd ~/.ssh

Generate files: ssh-keygen -t rsa -b 2048 -v

Fix file names:

mv id_rsa id_rsa.pem
mv id_rsa.pub authorized_keys

cat hostname.key hostname.crt PositiveSSLCA2.crt AddTrustExternalCARoot.crt > subsonic.crt

openssl pkcs12 -in subsonic.crt -export -out subsonic.pkcs12

sudo keytool -importkeystore -srckeystore subsonic.pkcs12 -destkeystore subsonic.keystore -srcstoretype PKCS12 -srcstorepass subsonic -srcalias 1 -destalias subsonic

sudo zip /var/subsonic/subsonic-booter-jar-with-dependencies.jar subsonic.keystore

@neonexus
neonexus / OpenSSL Commands.md
Last active May 17, 2016 14:24
AWS ELB OpenSSL commands list

Generate KEY and CSR:

openssl req -new -newkey rsa:2048 -nodes -keyout DOMAIN.key -out DOMAIN.csr

Echo the KEY in PEM format:

openssl rsa -in DOMAIN.key -outform PEM

Echo the CRT in PEM format:

@neonexus
neonexus / Git Shortcuts.md
Last active November 13, 2018 04:46
Git shortcuts

Git Shortcuts

What do they do?

The following blob is a set of basic setup configuration for Git, along with some shortcuts that I personally use.

Here we assume that you are working on your own, local branch (basically, not the master).

The shortcuts and what they do

@neonexus
neonexus / 1ubuntu-server.md
Last active May 12, 2019 21:14
PHP, Nginx (configured for WP too), MySQL (connector and/or server)

Neo's AWS Guide for Nginx, PHP, MySQL

Foreword

This guide assumes you've created an EC2 instance on AWS, with 2 drives (1 for the OS, 1 where the actual site(s) live). The 2 drive system allows for easier replacement of the OS/software side if something breaks, while keeping site data intact.

Install PHP5-FPM, Nginx, MySQL, Git

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install php5.6-fpm php5.6-mysql php5.6-gd php5.6-mcrypt nginx git ntp
@neonexus
neonexus / fromUTF8Array.js
Last active September 25, 2019 20:06
Encode / decode UTF8 array in JavaScript (original: https://gist.github.com/joni/3760795)
function fromUTF8Array(data) { // array of bytes
let str = '',
i;
for (i = 0; i < data.length; i++) {
let value = data[i];
if (value < 0x80) {
str += String.fromCharCode(value);
} else if (value > 0xBF && value < 0xE0) {
@neonexus
neonexus / Count lines in git repo.md
Last active May 24, 2020 01:27
Count lines in git repo, minus common files / folders you didn't actually write.
git ls-files --exclude-standard -- ':!:**/*.[pjs][npv]g' ':!:**/*.ai' ':!:.idea' ':!:**/*.eslintrc' ':!:package-lock.json' | xargs wc -l

':!:**/*.[pjs][npv]g' excludes all png, jpg and svg files.

':!:**/*.ai' excludes .ai files.

':!:.idea' excludes the .idea (WebStorm anyone?) folder.

@neonexus
neonexus / .bash_profile
Last active July 20, 2020 03:12
Git tools for the command line
source ~/.git-completion.sh
source ~/.git-prompt.sh
export GIT_PS1_SHOWDIRTYSTATE=1
export PS1='\[\033[00;00m\] \w\[\033[00;32m\]$(__git_ps1)\[\033[00m\] ⚡ '
# A quick way to find the answer: `google "cat videos"` (Mac OSX / macOS)
function google() { open /Applications/Google\ Chrome.app/ "http://www.google.com/search?q=$1"; }
@neonexus
neonexus / Mac OSX Dock Spacer.sh
Last active July 20, 2020 03:20
Add spacer to Mac OSX Dock
# /bin/bash
alias add_spacer="defaults write com.apple.dock persistent-apps -array-add '{\"tile-type\"=\"spacer-tile\";}'; killall Dock"