Skip to content

Instantly share code, notes, and snippets.

View assertnotnull's full-sized avatar
🏠
Working from home

Patrice Gauthier assertnotnull

🏠
Working from home
View GitHub Profile
@assertnotnull
assertnotnull / mysql.yaml
Created July 27, 2018 14:26
kubernetes mysql init loading sql on entrypoint
---
apiVersion: v1
kind: Service
metadata:
name: mysql
spec:
ports:
- port: 3306
nodePort: 30306
selector:
@assertnotnull
assertnotnull / docker-compose.yml
Last active May 8, 2018 21:36
docker compose dev services
services:
nginx-proxy:
image: jwilder/nginx-proxy
container_name: nginx-proxy
ports:
- "80:80"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- .:/etc/docker-gen/templates
- ./certs:/etc/nginx/certs
@assertnotnull
assertnotnull / index.js
Created May 27, 2016 18:30
forward seneca logging to bunyan
var config = {
log: {fileinfo: {level: 'INFO', filename: 'whitelabel'}, console: {level: 'DEBUG'}, name: 'whitelabel'},
seneca: {level: 'INFO'}
}
var bunyan = require('bunyan-loader')(config) //setup bunyan
bunyan.info('Using node', process.version)
var seneca = require('seneca')
var logger = bunyan.child({scope: 'seneca'})
seneca = seneca({
log: {
@assertnotnull
assertnotnull / README.md
Last active May 13, 2016 14:19
Graphite events

Graphite annotations

##Using graphite tags

I suggest use of tags like: appname, environment, host, eventtype

So we can search them

Using graphite sets

@assertnotnull
assertnotnull / .screenrc
Created April 28, 2016 18:33
screen config
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %m-%d %{W}%c %{g}]'
@assertnotnull
assertnotnull / asClassv1.js
Last active April 22, 2016 13:41
Ways to define modules in node
var onedep = require('one');
var self;
function AsClass(param) {
this.param = param;
}
AsClass.prototype.doSomething(param) {
console.log('can access',self.param);
onedep('whatever', function() {
@assertnotnull
assertnotnull / RiotControl.js
Last active November 18, 2016 13:56
Autonomous riot.js paging
var RiotControl = {
_stores: [],
addStore: function(store) {
this._stores.push(store);
}
};
['on','one','off','trigger'].forEach(function(api){
RiotControl[api] = function() {
var args = [].slice.call(arguments);
@assertnotnull
assertnotnull / cookie.html
Created November 10, 2015 18:48
Simple riot tag update
@assertnotnull
assertnotnull / reduce.js
Created September 3, 2015 16:12
Simple sum of promises
var Q = require('q');
var myarr = [1,2,3,4,5];
Q.resolve(myarr).then(function (results) {
return results.reduce(function (prev, current) {
console.log(prev, current);
return prev + current;
})
}).then(function (sum) {
@assertnotnull
assertnotnull / socketlogger.js
Created June 11, 2015 16:14
somewhat reusable socket logger
//somewhat reusable module socketlogger - it requires the usage of global.socket
//so it's not passed to every log function.
function SocketLogger() {}
var getLogger = function(categoryName) {
SocketLogger.prototype = log4js.getLogger(categoryName);
['Trace','Debug','Info','Warn','Error','Fatal', 'Mark'].forEach(
function (levelString) {
var level = log4js.levels.toLevel(levelString);