Skip to content

Instantly share code, notes, and snippets.

@Jpuelpan
Jpuelpan / rethinkdb_session_store.rb
Created September 8, 2015 19:22
RethinkDB and NoBrainer Session Store for Ruby on Rails 4
# lib/rethinkdb_session_store.rb
require 'rethinkdb'
class RethinkdbSessionStore < ActionDispatch::Session::AbstractStore
def initialize(app, options = {})
super
@r = RethinkDB::RQL.new.table('sessions')
end
def get_session(env, session_id)
description "Application service"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
setuid appuser
setgid www-data
env PATH=/home/user/app/environment/bin
@Jpuelpan
Jpuelpan / abstract_api.rb
Last active December 5, 2016 19:06
Abstract REST API Wrapper
require 'json'
require 'faraday'
require 'hashie/mash'
class AbstractApi
BASE_URL = ENV['ABSTRACT_API_BASE_URL'] || 'https://myapp.com/api'
API_VERSION = ENV['ABSTRACT_API_BASE_URL_VERSION'] || 'v1'
class Client
attr_reader :access_token, :base_url, :apiver
# /etc/init/foreverinit.conf
#description "Forever process"
#start on startup
#stop on shutdown
#setuid myuser
#setgid myuser
#expect fork
@Jpuelpan
Jpuelpan / dp.js
Created September 13, 2017 05:08
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const exec = require('child_process').execSync;
const [ , , ...args] = process.argv;
// Check if is a git repo
if( !fs.existsSync('./.git') ){
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const exec = require('child_process').execSync;
const uuid = require('uuid');
const S3_BUCKET = 'YOUR_BUCKET_NAME';
const [ , , ...args] = process.argv;
@Jpuelpan
Jpuelpan / tunnel-client.service
Last active October 22, 2018 03:47
Tunneld systemd.service
[Unit]
Description=Tunnel Client
After=network.target
[Service]
User=root
Restart=always
WorkingDirectory=/etc/tunnel
SyslogIdentifier=tunneld-client
ExecStart=/usr/bin/tunnel -config /etc/tunnel/tunnel.yml start-all
const ListItems = () => {
const items = [
"Aline",
"Clemmie",
"Sheba",
"Netty",
"Spencer",
"Aube",
"Monika",
"Mitch",