Skip to content

Instantly share code, notes, and snippets.

Roman Mirr romiras

Block or report user

Report or block romiras

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@romiras
romiras / Gemfile
Created May 8, 2019
EventMachine async URL fetcher
View Gemfile
source "https://rubygems.org"
gem 'eventmachine'
gem 'em-http-request'
@romiras
romiras / dictionary-gnu-sort-bd.txt
Last active Mar 8, 2019 — forked from klauspost/dictionary-sorted.txt
Brotli dictionary - printed escaped - sorted with "sort -bd" (with dictionary order, ignoring blanks), a tool from GNU coreutils
View dictionary-gnu-sort-bd.txt
"<!--"
"><!--"
"||[];"
"--><!--"
"--></"
"----"
"!--<"
"//--></"
"//-->"
"...</"
@romiras
romiras / ebk_decrypter.rb
Last active Jun 9, 2018
EBK backup extraction scripts
View ebk_decrypter.rb
# Note: KIES_KEY and KIES_IV must be passed as environment variables for work.
require 'openssl'
CRYPT_BLOCK_LEN = 0x110
CRYPT_BLOCK_PAD = 0x100
cipher = OpenSSL::Cipher::AES256.new(:CBC)
cipher.decrypt
cipher.key = ENV['KIES_KEY']
@romiras
romiras / rezip.py
Created Jan 14, 2017
ReZip - tool for recompression Zip files, used to efficiently store in SCM
View rezip.py
#!/usr/bin/env python3
"""Read zip format file from stdin and write new zip to stdout.
With the --store option the output will be an uncompressed zip.
Uncompressed files are stored more efficiently in VCS.
Example:
python rezip.py --store < file.docx > file.flat.docx
Based on https://github.com/costerwi/rezip
@romiras
romiras / simple_fuzzy_match.rb
Created Dec 30, 2016
Simple function for fuzzy string match
View simple_fuzzy_match.rb
require 'active_support/all' # mb_chars
def simple_fuzzy_match(s1, s2)
levenshtein_distance( normalize_str(s1), normalize_str(s2) ) < 2
end
def normalize_str(s)
s.
mb_chars. # convert to multibyte string (ActiveSupport::Multibyte::Chars) - required in Ruby version below 2.4
downcase. # lower case for all characters
@romiras
romiras / Makefile.win
Created Jan 13, 2016
TestDLL.exe - console program for testing DLL dependencies. Usage: testdll.exe libcairo-2.dll
View Makefile.win
# Project: TestDLL
# Makefile created by Dev-C++ 5.5.1
CPP = g++.exe
CC = gcc.exe
WINDRES = windres.exe
OBJ = main.o
LINKOBJ = main.o
LIBS = -L"C:/Program Files/Development/Dev-Cpp/MinGW32/lib" -L"C:/Program Files/Development/Dev-Cpp/MinGW32/mingw32/lib" -static-libstdc++ -static-libgcc
INCS = -I"C:/Program Files/Development/Dev-Cpp/MinGW32/include"
@romiras
romiras / my.conf
Created Oct 20, 2015
Redmine, DokuWiki, ownCloud - powered by NGINX with PHP5-FPM & Passenger
View my.conf
upstream php-handler {
server 127.0.0.1:9000;
# server unix:/var/run/php5-fpm.sock;
}
server {
listen 80;
server_name example.com localhost;
root /var/www;
@romiras
romiras / linux-bak-full.sh
Created Jul 16, 2015
Full system backup with dar
View linux-bak-full.sh
#!/bin/bash
# Full system backup with dar. Refer to http://dar.linux.free.fr/doc/Tutorial.html
## Configuration
# path to store dar backup files
Storage=/mnt/disk/backup/Linux
# name of system
SysName=Ubuntu_`. /etc/os-release; echo ${VERSION_ID/*, /}`
@romiras
romiras / gpipeview.c
Created May 11, 2015
GTK+ pipe viewer
View gpipeview.c
/*
Simple GTK+ pipe viewer
Contributors: Romiras
Based on paned.c
LICENSE: GNU GPLv3
*/
#include <stdio.h>
#include <unistd.h>
#include <gtk/gtk.h>
@romiras
romiras / backup.rake
Last active Aug 29, 2015 — forked from stevebartholomew/gist:50180
MySQL backup rake task for Rails 2.3.x
View backup.rake
# put this file into directory <RAILS_ROOT>/lib/tasks
namespace :db do
desc "Backup database"
task :backup do
RAILS_ENV = "development" if !defined?(RAILS_ENV)
settings = YAML.load(File.read(File.join(Rails.root, "config", "database.yml")))[RAILS_ENV]
bak_dir = ENV['BAK_DIR']
raise(RuntimeError, "==> Error: environment variable BAK_DIR not set.") if bak_dir.blank?
extra_parameters = ["--default-character-set=utf8"]
You can’t perform that action at this time.