Skip to content

Instantly share code, notes, and snippets.

const ListItems = () => {
const items = [
"Aline",
"Clemmie",
"Sheba",
"Netty",
"Spencer",
"Aube",
"Monika",
"Mitch",
@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
#!/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 / 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') ){
# /etc/init/foreverinit.conf
#description "Forever process"
#start on startup
#stop on shutdown
#setuid myuser
#setgid myuser
#expect fork
@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
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 / 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)
@Jpuelpan
Jpuelpan / custom_file_store.rb
Last active September 7, 2015 00:49 — forked from bradpauly/custom_file_store.rb
simple file store for rails sessions
module ActionDispatch
module Session
class CustomFileStore < ActionDispatch::Session::AbstractStore
def get_session(env, session_id)
session_data = {}
session_id ||= generate_sid
File.open(tmp_file(session_id),'r') do |f|
data = f.read
session_data = ::Marshal.load(data) unless data.empty?
end rescue nil
@Jpuelpan
Jpuelpan / elk.md
Last active August 29, 2015 14:17

A fast guide for installing an ELK system. Extracted from Install ELK in 14.04

Install Java 8

sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
sudo apt-get -y install oracle-java8-installer