Skip to content

Instantly share code, notes, and snippets.

View zorbash's full-sized avatar
👨‍💻
'); DROP TABLE recruiters;

Dimitris Zorbas zorbash

👨‍💻
'); DROP TABLE recruiters;
View GitHub Profile
fname=/home/zorbash/Pictures/interval/`date +"%m_%d_%y_%H%M%S"`
fswebcam -r 640x480 --jpeg 85 ${fname}.jpg
convert ${fname}.jpg -resize 1920x1080 ${fname}.jpg
export DISPLAY=:3
scrot ${fname}s.jpg
montage -mode concatenate -tile 1x ${fname}s.jpg ${fname}.jpg ${fname}_combined.jpg
@zorbash
zorbash / nginx.conf
Last active August 29, 2015 13:56
nginx + mruby experiment, /songs/random endpoint.
server {
location /songs/random {
mruby_content_handler '/var/www/apps/songs/random.rb';
}
location /words/random {
mruby_content_handler '/var/www/apps/words/random.rb';
}
}
@zorbash
zorbash / random.rb
Created February 24, 2014 21:16
ngix + mruby experiment
begin
word = `shuf /usr/share/dict/words | head -1`.chomp
Nginx::rputs JSON::stringify({ word: word})
rescue Exception => e
Ngixn::rputs e
end
@zorbash
zorbash / sinatra_random.rb
Last active August 29, 2015 13:56
experiment with sinatra
require 'sinatra'
require 'json'
require 'sqlite3'
get '/songs/random' do
db = SQLite3::Database.new '/var/www/apps/shared/songs.db'
row = db.execute('SELECT * FROM songs ORDER BY RANDOM() LIMIT 1;')[0]
song = {
id: row[0],
@zorbash
zorbash / express_random.js
Created February 24, 2014 23:15
Example api with nodejs and express framework
express = require('express');
sqlite3 = require('sqlite3').verbose();
http = require('http');
exec = require('child_process').exec;
db = new sqlite3.Database('/var/www/apps/shared/songs.db');
app = express();
app.listen(9999);
@zorbash
zorbash / main_controller.rb
Created February 25, 2014 00:19
Example api with plain RoR
class MainController < ApplicationController
def songs_random
row = ActiveRecord::Base.connection
.execute("SELECT * FROM songs ORDER BY RANDOM() LIMIT 1;")[0]
render json: { song: row.delete_if { |key, _| key.to_s =~ /^[0-9]+$/ } }
end
def words_random
render json: { word: `shuf /usr/share/dict/words | head -1`.chomp }
require 'oauth2'
require 'net/http'
require 'json'
CID = 'my_cid'
PAS = 'my_pass'
RDR = 'rdr_url'
# OAuth2 client object
def client
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = 'debian_jessie_64'
config.vm.box_url = 'http://vagrant.zorbash.com/boxes/debian_jessie_64.box'
# Make the vm accessible at the defined ip
config.vm.network :private_network, ip: "192.168.77.35"
config.vm.network :forwarded_port, guest: 22, host: 11234
@zorbash
zorbash / .csscomb.json
Created October 6, 2014 11:44
csscomb confib
{
"remove-empty-rulesets": true,
"always-semicolon": true,
"color-case": "lower",
"block-indent": " ",
"element-case": "lower",
"leading-zero": false,
"quotes": "single",
"space-before-colon": "",
"space-after-colon": " ",
-webkit-border-radius: 1px;
-moz-border-radius: 1px;
border-radius: 1px;