Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Chris Fidao fideloper

🏠
Working from home
Block or report user

Report or block fideloper

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Jenkinsfile
pipeline {
agent any
stages {
stage('Checkout') {
steps {
checkout scm
sh 'rm -rf build/{logs,pdepend}'
@mpstenson
mpstenson / Resize_Column_Based_On_Content.sql
Created Aug 31, 2016
Resize Column Based On Content (for mysql
View Resize_Column_Based_On_Content.sql
SET @column_name = 'Custom2';
select @column_name;
SET @width_query = CONCAT('SET @max_width = (SELECT CHAR_LENGTH(' , @column_name , ') AS mlen FROM `HS_Request` ORDER BY mlen DESC LIMIT 1)+10;');
PREPARE stmt FROM @width_query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @query = CONCAT('ALTER TABLE HS_Request MODIFY ', @column_name, ' VARCHAR(', @max_width, ');');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
@sandcastle
sandcastle / aurora_cluster.tf
Created Mar 25, 2016
Creates a AWS RDS Aurora Cluster with Terraform
View aurora_cluster.tf
########################
## Variables
########################
variable "environment_name" {
description = "The name of the environment"
}
variable "vpc_id" {
@alexbilbie
alexbilbie / Caddyfile
Created Jan 7, 2016
PHP-FPM Caddyfile example
View Caddyfile
root /app/public
tls /app/_docker/caddy/server.crt /app/_docker/caddy/server.key
fastcgi / php:9000 php
errors visible
rewrite {
regexp .*
ext /
to /index.php?{query}
}
View sendy.nginx
server {
listen 80;
listen [::]:80;
server_name site.com;
root /home/forge/site.com;
# FORGE SSL (DO NOT REMOVE!)
# ssl on;
# ssl_certificate;
# ssl_certificate_key;
@pjv
pjv / hhvm.conf
Last active Jan 18, 2016
Ubuntu 14.04 upstart script for HHVM
View hhvm.conf
# 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]
View VagrantXDebug.md

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 May 29, 2019
How to convert a .pfx SSL certificate to .crt/key (pem) formats. Useful for NGINX
View Howto convert a PFX to a seperate .key & .crt file
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 Jan 2, 2016
ElasticSearch Install
View elasticsearch.yml
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 Jun 9, 2019
Encrypt a text field in Mongoose MongoDB ORM
View mongoose-encrypted-schematype-field.md

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,
You can’t perform that action at this time.