This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "kemal" | |
require "json" | |
connected_sockets = {} of String => Array(HTTP::WebSocket) | |
connected_users = {} of String => Hash(String, JSON::Any) | |
def broadcast(data, sockets) | |
sockets.each do |socket| | |
socket.send data.to_json | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Beware arguments have a limit size ... | |
require "./mustache_cr/*" | |
require "option_parser" | |
require "json" | |
require "crustache" | |
require "base64" | |
module MustacheCr | |
template = "" | |
json = {} of String => String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
require 'json' | |
DB_USER = '<your_user>'.freeze | |
DB_PASS = '<your_password>'.freeze | |
DB_ENDPOINT = 'http+tcp://0.0.0.0:8529'.freeze | |
DUMP_PATH = '/path/to/your/dump/folder/'.freeze # must exist | |
DB_URL = 'http://0.0.0.0:8529'.freeze | |
uri = URI(DB_URL + '/_api/database') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var net = require('net'); | |
var HOST = '127.0.0.1'; | |
var PORT = 8888; | |
function rand(i) { | |
return parseInt((Math.random() * 10000) % i); | |
} | |
net.createServer(function(sock) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var loadFields = function() { | |
// { r: new_row, c: classname, n: name/id, t: type, j: joi validation, l: label, d: data list } | |
fields = [ | |
{ r: true, c: "1-1", n: "title", t: "string", j: joi.string().required(), l: "Title" }, | |
{ r: true, c: "1-2", n: "date", t: "date", j: joi.string().required(), l: "Publishing Date" }, | |
{ r: false, c: "1-2", n: "draft", t: "list", j: joi.string().required(), l: "Draft?", d: [["y", "Yes"], ["n", "No"]] }, | |
{ r: true, c: "1-1", n: "text", t: "text", j: joi.string().required(), l: "Text"} | |
] | |
schema = {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var loadFields = function() { | |
// { r: new_row, c: classname, n: name/id, t: type, j: joi validation, l: label, d: data list } | |
fields = [ | |
] | |
schema = {} | |
each(fields, function(f) { | |
schema[f.n] = f.j | |
}) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Github | |
require 'net/http' | |
require 'json' | |
def initialize(login) | |
@login = login | |
end | |
def favourites_languages | |
json = load_json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'acme-client' | |
#Production | |
#ENDPOINT = 'https://acme-v01.api.letsencrypt.org' | |
#Testing | |
ENDPOINT = 'https://acme-staging.api.letsencrypt.org' | |
EMAIL = 'mailto:[email protected]' | |
DOMAIN = 'lolware.net' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on Ubuntu 12.04 from OVH VPS | |
sudo aptitude update | |
aptitude install build-essential git git-core curl zlib1g-dev libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties ruby redis-server memcached ruby-dev ufw htop fail2ban imagemagick libmagickwand-dev nodejs npm -y ruby libmysqlclient-dev | |
sudo echo "gem: --no-ri --no-rdoc" > ~/.gemrc | |
sudo gem install passenger -v 4.0.59 | |
sudo passenger-install-nginx-module --auto --auto-download --languages 'ruby' | |
sudo gem install rails -v 2.3.15 | |
sudo gem install atom -v 0.3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user admin; | |
worker_processes 1; | |
#error_log logs/error.log; | |
#error_log logs/error.log notice; | |
#error_log logs/error.log info; | |
#pid logs/nginx.pid; | |