Skip to content

Instantly share code, notes, and snippets.

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

Jean-Pierre Pommet jppommet

🏠
Working from home
View GitHub Profile
@jppommet
jppommet / drone_local_setup.md
Last active January 18, 2016 09:01
Drone.io Local Setup

Grab docker image from DockerHub and install into your docker machine environment docker pull drone/drone:0.4 mkdir -p /usr/local/etc/drone/dronerc

Edit your file dronerc

REMOTE_DRIVER=github
REMOTE_CONFIG=https://github.com?client_id=${client_id}&client_secret=${client_secret}
@jppommet
jppommet / app.py
Created June 7, 2016 20:32
youtube-dl wrapper for AWS Lambda
from __future__ import unicode_literals
from youtube_dl import YoutubeDL
import boto3
import os
class Logger(object):
def debug(self, msg):
pass
@jppommet
jppommet / snsToSlack.js
Created June 13, 2016 23:26 — forked from terranware/snsToSlack.js
AWS Lambda function to Slack Channel hookup
var https = require('https');
var util = require('util');
exports.handler = function(event, context) {
console.log(JSON.stringify(event, null, 2));
console.log('From SNS:', event.Records[0].Sns.Message);
var postData = {
"channel": "#aws-sns",
"username": "AWS SNS via Lamda :: DevQa Cloud",

Multiple MySQL Versions with Homebrew

For homebrew version 0.9.5.

brew -v # => Homebrew 0.9.5

Install the current version of mysql.

# Install current mysql version

brew install mysql

@jppommet
jppommet / run_mysql56.sh
Created August 16, 2016 17:51
Run MySQL 5.6 locally by skipping mysql.users lookup (w/ previous MySQL 5.7 installation)
$ mysqld_safe --bind-address=127.0.0.1 --data-dir=/usr/local/var/mysql --skip-grant-tables --user=root
@jppommet
jppommet / _service.md
Last active October 17, 2016 07:51 — forked from naholyr/_service.md
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@jppommet
jppommet / caddy_server_init.sh
Created December 22, 2016 07:45
Caddy Server System V init script
#!/bin/bash
# Caddy daemon
# chkconfig: 345 20 80
# description: Caddy daemon
# processname: caddy
DAEMON_PATH="/usr/local/bin"
DAEMON='./caddy'
DAEMONOPTS="-conf=/etc/caddy/Caddyfile -log /var/log/caddy.log"

It seems that it does not matter what timezone is on the server as long as you have the time set right for the current timezone, know the timezone of the datetime columns that you store, and are aware of the issues with daylight savings time.

On the other hand if you have control of the timezones of the servers you work with then you can have everything set to UTC internally and never worry about timezones and DST.

Here are some notes I collected of how to work with timezones as a form of cheatsheet for myself and others which might influence what timezone the person will choose for his/her server and how he/she will store date and time.

MySQL Timezone Cheatsheet

@jppommet
jppommet / lambda-concurrent.sh
Created June 17, 2017 23:05 — forked from smithclay/lambda-concurrent.sh
Concurrently execute a lambda function for warming purposes
#!/bin/bash
# This attempts to concurrently execute an AWS Lambda function. WIP.
# After execution, roughly NUM_EXECUTION containers will be ready
# to accept requests.
# More advanced strategies are out there. Check out @lambdacult on twitter, for example.
AWS_LAMBDA_FUNCTION_NAME=LambdaInfo
NUM_EXECUTIONS=3
@jppommet
jppommet / pre-commit.sh
Created August 3, 2017 23:41
git pre-commit hook rubocop ruby modified/staged files
#!/bin/sh
#TODO: add exclude <file>.rb in rubocop.yml ?
git status --porcelain | egrep "^(A|AM|^M).+\.rb$" | awk '{print $NF}' | xargs rubocop -a