Skip to content

Instantly share code, notes, and snippets.

@kp666
kp666 / gosugol.rb
Last active February 28, 2019 14:28
require 'gosu'
class Tutorial < Gosu::Window
def initialize(board_width, board_height, pattern_file)
@board_width = board_width
@board_height = board_height
@columns = board_width / 12
@rows = board_height / 12
super @board_width, @board_height, update_interval: 100
@kp666
kp666 / Test.csv
Created October 22, 2018 13:01
Test
Paris 1 2
class Country < ActiveRecord::Base
end
@kp666
kp666 / .block
Created June 5, 2018 09:36
Basic scatter plot
license: mit
@kp666
kp666 / .block
Last active May 27, 2018 19:30
fresh block
license: mit
@kp666
kp666 / n2s.rb
Created September 22, 2017 13:58
def process(file)
text = File.read(file)
string = text.lines.first
string.split(', ')
.map {|c| c.split("=")}
.inject({}) {|c, v| c[v[0]]=v[1].to_s.split(" ").map(&:to_i); c}
.inject([]) {|k, v| v[1].each {|i| k[i] = v[0]}; k}
.join
end
def all_alphabets
[[*'A'..'Z'], [*'a'..'z']]
end
def rotated_by_key(key)
all_alphabets.flat_map{|x|x.rotate(key)}
end
def ceaser(string,key)
string.tr(all_alphabets.join,rotated_by_key(key).join)
...............[libsecp256k1] illegal argument: Invalid flags
Aborted (core dumped)
rake aborted!
@kp666
kp666 / translate.js
Created May 26, 2017 05:40 — forked from mgechev/translate.js
Translate.js
var translate = (function () {
var symbols = {
a: '([]+![])[+!+[]]',
b: '([]+{})[+!+[]+!+[]]',
c: '([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]]',
d: '([]+[][+[]])[+!+[]+!+[]]',
e: '([]+[][+[]])[+!+[]+!+[]+!+[]]',
f: '([]+[][+[]])[+!+[]+!+[]+!+[]+!+[]]',
g: '([]+([]+[])[([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]]+([]+[][+!+[]])[+!+[]]+([]+![])[+!+[]+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+!![])[+!+[]]+([]+!![])[+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]]+([]+!![])[+!+[]]])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]',
h: '(+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[])[([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]]+([]+([]+[])[([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!+[]]+([]+[][+!+[]])[+!+[]]+([]+![])[+!+[]+!+[]+!+[]]+([]+{})[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+!![])[+!+[]]+([]+!![])[+!+[]+!+[]]
@kp666
kp666 / db.rake
Created March 19, 2017 05:49 — forked from hopsoft/db.rake
Rails rake tasks for dump & restore of PostgreSQL databases
# lib/tasks/db.rake
namespace :db do
desc "Dumps the database to db/APP_NAME.dump"
task :dump => :environment do
cmd = nil
with_config do |app, host, db, user|
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump"
end
puts cmd