Skip to content

Instantly share code, notes, and snippets.

🏓
Focusing

Ryan Wuster ryanhanwu

🏓
Focusing
Block or report user

Report or block ryanhanwu

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
@ryanhanwu
ryanhanwu / Dockerfile
Created Feb 26, 2019
muti-stage build for node+babel+docker
View Dockerfile
# common base image for development and production
FROM node:10.11.0-alpine AS base
WORKDIR /app
# dev image contains everything needed for testing, development and building
FROM base AS development
COPY package.json yarn.lock ./
# first set aside prod dependencies so we can copy in to the prod image
View inArray.asp
<%
Function InArray(Needle, Haystack)
Dim i, x
InArray = False
For i = 0 To Ubound(Haystack)
If IsArray(Needle) = True Then
For x = 0 To Ubound(Needle)
If Trim(Haystack(i)) = Trim(Needle(x)) Then
InArray = True
View test.sh
aws s3api list-objects --bucket BUCKETNAME --output json --query "[sum(Contents[].Size), length(Contents[])]"
View filepreview.js
/*
filepreview : A file preview generator for node.js
*/
var child_process = require('child_process');
var crypto = require('crypto');
var async = require('async');
var path = require('path');
View append.js
fs.appendFile('message.txt', 'data to append', function (err) {
if (err) throw err;
console.log('Saved!');
});
@ryanhanwu
ryanhanwu / parsekeyword.js
Last active Oct 25, 2018
Parse Double Quote #Search
View parsekeyword.js
module.exports= function parseKeywords(req, res, next){
const { q } = res.locals
//extract double quote terms
const re = /"(.*?)"/g
const phrases = []
let current
while ((current = re.exec(q))) {
phrases.push(current.pop())
}
//replace -_. with space for matches
@ryanhanwu
ryanhanwu / docker_est.sh
Last active Aug 30, 2018
Set docker timezone to EST
View docker_est.sh
#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
apt-get update && apt-get install -y tzdata
ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
dpkg-reconfigure --frontend noninteractive tzdata
@ryanhanwu
ryanhanwu / the-scratch.conf
Created May 4, 2018 — forked from korczis/the-scratch.conf
Nginx Node.js Proxy with caching, websockets, gzip
View the-scratch.conf
proxy_cache_path /var/cache/nginx/cache levels=1:2 keys_zone=cache:8m max_size=3000m inactive=600m;
proxy_temp_path /var/tmp;
# the IP(s) on which your node server is running. I chose port 3000.
upstream app_the_scratch {
server 127.0.0.1:3000 weight=1 fail_timeout=60s;
}
# the nginx server instance
server {
@ryanhanwu
ryanhanwu / dynamoScanPromise.js
Created Apr 26, 2017
A short snippet for scanning AWS DynamoDB table with AWS SDK and Promise
View dynamoScanPromise.js
var params = {
TableName: 'MYTABLE',
FilterExpression: 'contains (myKey , :query)',
ExpressionAttributeValues: {
':query': query
}
}
var dynamoScan = new Promise(function(resolve, reject) {
var results = []
View init.coffee
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
You can’t perform that action at this time.