Skip to content

Instantly share code, notes, and snippets.

View obonyojimmy's full-sized avatar
💻
probably coding

jimmycliff obonyo obonyojimmy

💻
probably coding
View GitHub Profile
@obonyojimmy
obonyojimmy / gist:6917ff2d5a3728668187bf3f39083031
Created July 15, 2017 02:46 — forked from belsrc/gist:672b75d1f89a9a5c192c
Simple Vue.js filters that I usually need
/**
* Changes value to past tense.
* Simple filter does not support irregular verbs such as eat-ate, fly-flew, etc.
* http://jsfiddle.net/bryan_k/0xczme2r/
*
* @param {String} value The value string.
*/
Vue.filter('past-tense', function(value) {
// Slightly follows http://www.oxforddictionaries.com/us/words/verb-tenses-adding-ed-and-ing
var vowels = ['a', 'e', 'i', 'o', 'u'];
@obonyojimmy
obonyojimmy / .gitlab.ci.yml
Created August 1, 2017 21:42 — forked from yannhowe/.gitlab.ci.yml
.gitlab.ci.yml for SSH with private key.
# Image neeeds to have ssh-client
image: docker:git
services:
- docker:dind
stages:
- staging
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
@obonyojimmy
obonyojimmy / meteor-nginx
Created August 2, 2017 21:45 — forked from dweldon/meteor-nginx
This is an example of how to configure nginx to serve a meteor app.
server {
listen [::]:80;
listen 80;
server_name app.example.com;
return 301 https://$server_name$request_uri;
}
server {
@obonyojimmy
obonyojimmy / Dockerfile
Created August 13, 2017 22:24 — forked from alkrauss48/Dockerfile
Running a docker container as a non-root user
# By default, Docker containers run as the root user. This is bad because:
# 1) You're more likely to modify up settings that you shouldn't be
# 2) If an attacker gets access to your container - well, that's bad if they're root.
# Here's how you can run change a Docker container to run as a non-root user
## CREATE APP USER ##
# Create the home directory for the new app user.
RUN mkdir -p /home/app
@obonyojimmy
obonyojimmy / .gitignore
Created August 30, 2017 21:33 — forked from miku/.gitignore
Golang XML worker queue example
xmlp
@obonyojimmy
obonyojimmy / meteordockersetup.yml
Created September 7, 2017 05:43 — forked from JulianKingman/meteordockersetup.yml
Docker setup, with SSL
nginx-proxy:
image: 'jwilder/nginx-proxy'
ports:
- '80:80'
- '443:443'
volumes:
- '/path/to/certs:/etc/nginx/certs:ro'
- '/etc/nginx/vhost.d'
- '/usr/share/nginx/html'
- '/var/run/docker.sock:/tmp/docker.sock:ro'
@obonyojimmy
obonyojimmy / protein_hgvs_for_snp_id.py
Created September 28, 2017 21:36 — forked from eweitz/protein_hgvs_for_snp_id.py
How to get protein change HGVS data for a given dbSNP RS ID, using NCBI EUtils
"""Python 3 script to get partial protein HGVS given NCBI dbSNP ID
Example:
$ python3 protein_hgvs_for_snp_id.py 334
snp_id:
334
gene:
{'name': 'HBB', 'gene_id': '3043'}
protein_change_hgvs:
@obonyojimmy
obonyojimmy / stream-file-upload-s3-nodejs.js
Created November 16, 2017 00:57 — forked from schempy/stream-file-upload-s3-nodejs.js
Streaming File Uploads To Amazon S3 With Node.js
var http = require('http');
var router = require('routes')();
var Busboy = require('busboy');
var AWS = require('aws-sdk');
var inspect = require('util').inspect;
var port = 5000;
// Define s3-upload-stream with S3 credentials.
var s3Stream = require('s3-upload-stream')(new AWS.S3({
accessKeyId: '',
@obonyojimmy
obonyojimmy / immutableJsExample.js
Created November 18, 2017 18:53 — forked from coryhouse/immutableJsExample.js
Handling React state via Immutable.js map
// At top, import immutable
import { Map } from 'immutable';
// Later, in constructor...
this.state = {
// Create an immutable map in state using immutable.js
user: Map({ firstName: 'Cory', lastName: 'House'})
};
updateState({target}) {
@obonyojimmy
obonyojimmy / tiny_uploader.js
Created November 20, 2017 02:18 — forked from alediaferia/tiny_uploader.js
A tiny snippet for reading files chunk by chunk in plain JavaScript
/*
* Valid options are:
* - chunk_read_callback: a function that accepts the read chunk
as its only argument. If binary option
is set to true, this function will receive
an instance of ArrayBuffer, otherwise a String
* - error_callback: an optional function that accepts an object of type
FileReader.error
* - success: an optional function invoked as soon as the whole file has been
read successfully