This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add Google Chrome for AWS Lambda as dependency in your function. | |
# based on https://github.com/alixaxel/chrome-aws-lambda#aws-lambda-layer | |
nvm use lts/dubnium | |
mkdir -p node_modules/chrome-aws-lambda/ | |
npm install lambdafs@~1.3.0 puppeteer-core@~1.20.0 --no-bin-links --no-optional --no-package-lock --no-save --no-shrinkwrap | |
npm pack chrome-aws-lambda | |
tar --directory node_modules/chrome-aws-lambda/ --extract --file chrome-aws-lambda-*.tgz --strip-components=1 | |
rm chrome-aws-lambda-*.tgz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# based on: http://knowledgevoid.com/blog/2012/01/13/logging-the-correct-ip-address-using-apache-2-2-x-and-amazons-elastic-load-balancer/ | |
# mod_evasive based on | |
# https://www.linode.com/docs/websites/apache-tips-and-tricks/modevasive-on-apache | |
# update cloudflare download link | |
# make sure you're root | |
sudo -i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Detecting which module is causing a global leak can be cumbersome and boring. But there is a nice little trick to find the little bastard. Add these lines at the very beginning of your tests: | |
Object.defineProperty(global, "name_of_leaking_property", { | |
set : function(value) { | |
throw new Error("Found the leak!"); | |
} | |
}) | |
// This will print a stacktrace that shows which module caused the leak. | |
// https://github.com/mochajs/mocha/wiki/Detecting-global-leaks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
apt-get -y update | |
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev | |
cd /tmp | |
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz | |
tar -xvzf ruby-1.9.3-p194.tar.gz | |
cd ruby-1.9.3-p194/ | |
./configure --prefix=/usr/local | |
make | |
make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DEFAULT_RUBY_VERSION="1.9.3-p125" | |
sudo apt-get update | |
sudo apt-get -y install curl git-core bzip2 build-essential zlib1g-dev libssl-dev autoconf libreadline6-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libgdbm-dev libncurses5-dev libtool bison pkg-config libffi-dev | |
if [ -x /usr/local/rvm/bin/rvm ]; then | |
echo "RVM Found..nothing to do"; | |
else | |
echo "Installing RVM"; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Client = require('mysql').Client, | |
client = new Client(); | |
client.user = 'user'; | |
client.password = 'password'; | |
client.host='127.0.0.1'; | |
client.port='3306'; | |
client.database='DB' | |
client.connect(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://github.com/mitchellh/vagrant/issues/1755 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var browserify = require('browserify'); | |
var async = require('async'); | |
var heapdump = require('heapdump'); | |
var memwatch = require('memwatch'); | |
// memwatch.on('stats', function(stats) { console.log( stats.usage_trend ) }); | |
// memwatch.on('leak', function(info) { console.log( info ) }); | |
var paths = [ | |
'./views/demo1/demo1.js', | |
'./views/demo2/demo2.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get data from file m.map | |
# this file has the map sourceName, destName | |
#i.e: | |
#/source/A.jpg,/dest/B.jpg | |
# split with awk and create an array, the use the array to scp | |
for i in $(cat m.map); do A=($(echo ${i}|awk -F"," '{print $1" "$2}'));scp ${A[0]} 1.1.1.1:${A[1]};done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from https://www.howtoforge.com/postgresql-ssl-certificates | |
This describes how to set up ssl certificates to enable encrypted connections from PgAdmin on some client machine to postgresql on a server machine. The assumption is that postgresql (compiled with ssl support) and openssl are already installed and functional on the server (Linux). PgAdmin is already installed on the client (either Windows or Linux). | |
On the server, three certificates are required in the data directory. CentOS default is /var/lib/pgsql/data/: | |
root.crt (trusted root certificate) | |
server.crt (server certificate) | |
server.key (private key) | |
Issue commands as root. |