Skip to content

Instantly share code, notes, and snippets.

View drexler's full-sized avatar
💭
flipping bits...

andrew quartey drexler

💭
flipping bits...
View GitHub Profile
@drexler
drexler / apiUriTemplate.vm
Last active August 14, 2017 15:31
extract AWS API Gateway url information with a mapping template
{
"headers": {
#foreach($param in $input.params().header.keySet())
"$param": "$util.escapeJavaScript($input.params().header.get($param))" #if($foreach.hasNext),#end
#end
},
"pathParams": {
#foreach($param in $input.params().path.keySet())
"$param": "$util.escapeJavaScript($input.params().path.get($param))" #if($foreach.hasNext),#end
#end
@drexler
drexler / PropertyExistence.vm
Last active September 13, 2017 18:51
Test for a property existence in a velocity template
{
#set($flag = false)
#set($missing = "'""""'")
#if("'$input.json('$.aJsonField')'" != $missing)
"JsonFieldIsPresent": $input.json('$.aJsonField')
#set($flag = true)
#end
#if("'$input.json('$.aJsonField')'" == $missing)
@drexler
drexler / .bashrc
Created December 2, 2017 14:58
Starting ssh-agent on shell loads
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
/usr/bin/ssh-add;
}
@drexler
drexler / gist:463676e7c36de6ddb01ea798eb308df8
Last active February 8, 2018 15:33 — forked from leoapost/gist:4318441
Delete all remote branches, except master
# Replace REMOTE_NAME with your remote name (e.g. origin)
git branch -r | grep REMOTE_NAME/ | grep -v 'master$' | grep -v HEAD| cut -d/ -f2 | while read line; do git push REMOTE_NAME :$line; done;

Background

While I'm learning how to use Nginx, I was instructed to update the server_names_hash_bucket_size (/etc/nginx/nginx.conf) value from 32 to 64, but I don't understand why should I increase the value to 64.

References

References that have been read so far:

@drexler
drexler / install.sh
Created April 17, 2018 01:28 — forked from ziadoz/install.sh
Install Chrome, ChromeDriver and Selenium on Ubuntu 16.04
#!/usr/bin/env bash
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
# http://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver
# http://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception
# http://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal
# http://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04
# Versions
CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`
@drexler
drexler / launch.json
Created April 27, 2018 00:30
Breakpoints ignored due to missing source maps
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Debug Project",
"url": "http://localhost:3000",
"sourceMaps": true,
"webRoot": "${workspaceFolder}",
@drexler
drexler / presignedUrl.jsonc
Last active May 3, 2018 20:11
uploading strategies
// Option one: directly upload base64 encoded files
// Pros: one network trip
// Cons: large attachments might cause processing delays and eventual lambda timeout
POST /tenants/{tenantId}/uploads
{
"items": [
{
"filename": "someLogo",
"filenameWithExtension": "someLogo.ext",
@drexler
drexler / PULL_REQUEST_TEMPLATE.md
Created May 9, 2018 01:20
Pull Request Template

What I implemented:

Closes #XXXXX

@drexler
drexler / install.sh
Created May 24, 2018 16:03
Install Chrome under WSL
# assumes you have ubuntu-desktop installed which includes stock libpulse
sudo add-apt-repository ppa:therealkenc/wsl-pulseaudio
sudo apt-get update && sudo apt-get upgrade
# Download the stable or development Chrome .deb package - dev if you want headless functionality
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
sudo apt -f install # probably
wget https://github.com/therealkenc/libudev-stub/releases/download/v0.9.0/libudev-stub-0.9.0-WSL.deb