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
#!/home/agorf/.rbenv/shims/ruby | |
require 'json' | |
workspaces = JSON.load(`i3-msg -t get_workspaces`) | |
num = ((1..10).to_a - workspaces.map {|w| w['num'] }).min | |
exec "i3-msg workspace #{num}" |
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
debounce: function(func, wait, immediate) { | |
if (typeof wait != 'number') { | |
wait = DEFAULT_INTERVAL; | |
} | |
var timeout, result; | |
return function() { | |
var context = this, args = arguments; | |
var later = function() { |
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
xmodmap -e 'clear Lock' -e 'keycode 0x42 = Escape' # map caps to escape | |
setxkbmap -option ctrl:nocaps #disable caps default functionality | |
setxkbmap -option grp:alt_shift_toggle us,gr # map alt shift to layout toggle |
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
XKBMODEL="pc105" | |
XKBLAYOUT="us,gr" | |
XKBVARIANT="" | |
XKBOPTIONS="grp:alt_shift_toggle caps:escape" |
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
crash.log | |
.ruby-version | |
.ruby-gemset | |
oauth.yml | |
tmp |
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
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'; | |
} | |
} |
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
begin | |
word = `shuf /usr/share/dict/words | head -1`.chomp | |
Nginx::rputs JSON::stringify({ word: word}) | |
rescue Exception => e | |
Ngixn::rputs e | |
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
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], |
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
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); |
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 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 } |