Skip to content

Instantly share code, notes, and snippets.

View georgy7's full-sized avatar

Георгий У. georgy7

View GitHub Profile
@georgy7
georgy7 / 410.rb
Created September 24, 2015 22:28
7-Zipped & WebPied imageboard spaghetti server.
#!/usr/bin/env ruby
# encoding: utf-8
require 'rubygems'
gem 'seven_zip_ruby'
require 'seven_zip_ruby'
require 'webrick'
require 'fileutils'
gem 'nokogiri'
require 'nokogiri'
@georgy7
georgy7 / neuraltalk_data_from_exif_keywords.py
Last active November 27, 2015 02:30
To train https://github.com/karpathy/neuraltalk2 on my own data. Just run from a folder with tagged JPEG images. I mean the keywords in the file properties.
# pip install exifread
import exifread
import array
import string
import glob
import json
KEYWORDS = 'Image XPKeywords'
OUTPUT = 'neuraltalk.json'
@georgy7
georgy7 / _cmykJpegToNormal.sh
Last active February 4, 2017 18:04
Strange JPEGs (CMYK, for instance) to normal JPEGs
trap '
trap - INT # restore default INT handler
kill -s INT "$$"
' INT
INPUT=StockByte
OUTPUT=StockByte_simple_jpeg
# It scans subfolders recursively, but...
@georgy7
georgy7 / dzip.d
Created February 28, 2017 11:08
D executable size experiment.
/++
+ Experiment 2017-02-28.
+ Author: Георгий Устинов
+ License: CC0.
+
+ Executable size on Linux x86_64
+ LDC2 0.17.1 (DMD v2.068.2, LLVM 3.8.0)
+
+ ldc2 dzip.d ............... 26.6 KiB (27 232)
+ ldc2 -release dzip.d ...... 26.5 KiB (27 176)
@georgy7
georgy7 / flog.d
Last active March 2, 2017 16:39
Factorial approximation
/// License: CC0
import std.math;
real flog10(long n) {
real r = 0;
foreach (i; 1..(n+1)) {
r += log10(i);
}
return r;
@georgy7
georgy7 / webpStatistics.d
Last active March 2, 2017 16:56
Size statictics of WebP on the different levels.
#!/usr/bin/env dub
/+ dub.json:
{
"name": "lalala",
"authors": [
"Георгий Устинов"
],
"license": "Unlicense",
"dependencies": {
"dlib-webp": "~>0.0.6",
#! /usr/bin/ruby
require 'rubygems'
require 'digest/md5'
require 'json'
# Usage:
# 1. Locate a folder where you want to search dublicates in console.
# 2. Run the script without any arguments.
# 3. Watch the progress.
bool read = false;
int tries = 0;
while (!read && tries < 5) {
try {
if (wrongFoot) {
throw new GotUpOnTheWrongFoot();
}
// Yes, I really doesn't care if something
// much deeper in it throws the exception.
@georgy7
georgy7 / .gitignore
Created May 6, 2017 12:17
Статьи с тегами. Тестовые данные для бенчмарков.
.idea
.directory
data