Skip to content

Instantly share code, notes, and snippets.

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

Chris Fidao fideloper

🏠
Working from home
View GitHub Profile
@pjv
pjv / hhvm.conf
Last active January 18, 2016 18:04
Ubuntu 14.04 upstart script for HHVM
# hhvm - HipHop VM
#
# The HipHopVM server provides a high performance PHP stack and web server.
# modified by pjv from original found here: http://stackoverflow.com/questions/19013516/upstart-script-for-hhvm-hiphop
description "HHVM server"
author "pjv https://gist.github.com/pjv/2e9ab32d8d9884bf79a4"
start on filesystem or runlevel [2345]
stop on runlevel [!2345]

Configure

xdebug.ini

xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.remote_connect_back=1
@TemporaryJam
TemporaryJam / Howto convert a PFX to a seperate .key & .crt file
Last active April 4, 2024 10:52
How to convert a .pfx SSL certificate to .crt/key (pem) formats. Useful for NGINX
source: http://www.markbrilman.nl/2011/08/howto-convert-a-pfx-to-a-seperate-key-crt-file/
`openssl pkcs12 -in [yourfile.pfx] -nocerts -out [keyfile-encrypted.key]`
What this command does is extract the private key from the .pfx file. Once entered you need to type in the importpassword of the .pfx file. This is the password that you used to protect your keypair when you created your .pfx file. If you cannot remember it anymore you can just throw your .pfx file away, cause you won’t be able to import it again, anywhere!. Once you entered the import password OpenSSL requests you to type in another password, twice!. This new password will protect your .key file.
Now let’s extract the certificate:
`openssl pkcs12 -in [yourfile.pfx] -clcerts -nokeys -out [certificate.crt]`
@dhrrgn
dhrrgn / elasticsearch.yml
Last active January 2, 2016 12:29
ElasticSearch Install
cluster.name: "my-es"
index.number_of_shards: 5
index.number_of_replicas: 1
cloud:
aws:
region: us-east-1
access_key: <key here>
secret_key: <secret here>
@kljensen
kljensen / mongoose-encrypted-schematype-field.md
Last active June 6, 2023 13:25
Encrypt a text field in Mongoose MongoDB ORM

Encrypting text fields in Mongoose is easy using Node's built-in crypto module. You might want to do this if you're using MongoDB as a service (see the recent MongoHQ security breach); or, if you're storing OAuth tokens that could, in the wrong hands, screw with somebody's account on a 3rd party service. (Of course, you should never encrypt passwords: those should be hashed.)

Imagine you have a Mongoose model like that shown below, which is modified only slighly from the example on the MongooseJS homepage.

var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/test');

var User = mongoose.model('User', {
 name: String,
@dhrrgn
dhrrgn / foo.py
Last active December 25, 2015 21:49
Why am I not getting the full git clone output here?
# assume all imports are done
#Old: proc = subprocess.Popen(['git', 'clone', '[url here]'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# Fixed
proc = subprocess.Popen(['git', 'clone', '--progress' '[url here]'],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
while proc.poll() is None:
@refringe
refringe / sendy-server
Last active February 5, 2024 07:50
Nginx configuration file example for Sendy (http://sendy.co/).
server {
listen 80;
listen [::]:80;
server_name domain.com;
autoindex off;
index index.php index.html;
root /srv/www/domain.com/public;
@kapv89
kapv89 / query-logger.php
Last active January 8, 2019 15:21
Log Queries in L4
<?php
Event::listen('illuminate.query', function($query, $bindings, $time) {
static $count;
if(App::make('env') === 'local')
{
$logFile = __DIR__.'/../storage/logs/queries';
ob_start();
var_dump($bindings, $query);
$str = ob_get_clean();
if($count === null)
@EpocSquadron
EpocSquadron / .gitconfig
Created April 5, 2013 16:10
My global git config
[core]
# Don't track permissions other than standard modes.
filemode = false
# Don't ignore File -> file changes.
ignorecase = false
# Vim is better.
editor = vim
[color]
ui = true
[help]
@EpocSquadron
EpocSquadron / git-deshitifer.sh
Created August 3, 2012 16:02
Remove files from a repo that should be ignored but you dont neccesarily want to delete from filesystem.
#!/bin/bash
# Regexes matching files and folders in the gitignore that should never be in a repo.
GITIGNORE_REGEXES=( ".+\.(diff|err|orig|log|rej|swo|swp|vi|sass-cache|sublime-project|sublime-workspace|komodoproject|esproj|espressostorage|rbc)" ".+\~" "\.\/\.(DS_Store|_.+|cache|project|settings|tmproj|komodotools|hg|svn|CVS|idea)" "\.\/(nbproject|Thumbs\.db|_notes|dwsync\.xml)" )
# Get rid of them in git, leave them in filesystem.
for REGEX in "${GITIGNORE_REGEXES[@]}"; do
FILES=`find -E . -iregex "$REGEX" | sed 's/^..//;' | tr '\n' ' '`
echo "## Regex: $REGEX"
if [ ! "$FILES" = "" ]; then