Skip to content

Instantly share code, notes, and snippets.

View Envek's full-sized avatar
☮️
Stop the war | Нет войне!

Andrey Novikov Envek

☮️
Stop the war | Нет войне!
View GitHub Profile
@Envek
Envek / pg_schema_dump_pkey_bug_test.rb
Created July 9, 2014 19:45
ActiveRecord::SchemaDumper does not correctly dump UUID primary keys (when you use not uuid-ossp but pgcrypto)
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'rack', github: 'rack/rack'
gem 'pg'
GEMFILE
system 'bundle'
@Envek
Envek / Gemfile
Created February 3, 2015 14:14
Temporary script to get GLONASS/GPS data from Skuapso PSQL module: https://github.com/skuapso/psql
source "https://rubygems.org"
gem "pg"
gem "activesupport"
@Envek
Envek / keybase.md
Created May 26, 2015 08:17
Identity proof for keybase.io

Keybase proof

I hereby claim:

  • I am Envek on github.
  • I am envek (https://keybase.io/envek) on keybase.
  • I have a public key whose fingerprint is 5439 E3DC F03F 4317 524E E679 301A D540 0512 05A2

To claim this, I am signing this object:

@Envek
Envek / rails_time_with_offset_test.rb
Last active September 2, 2015 09:33
Bug report of incorrect parsing of time when assigning to time attributes.
# For Ruby on Rails master branch
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
@Envek
Envek / dpms
Created October 21, 2010 23:13
Terminal touchscreen manipulation script (from console)
#!/bin/bash
# Данный скрипт управляет возможностями энергосбережения монитора в X.Org
# ./dpms enable -- Разрешает отключать монитор для экономии энергии
# ./dpms disable -- Запрещает отключать монитор для экономии энергии
# Для прочего смотрите xset q, секция DPMS
usage="Usage: ./dpms < enable | disable | show | set [standby [suspend [off]]] | reset>"
# Reset values
@Envek
Envek / maxprimemultiplier.cpp
Created July 13, 2011 11:47
Calculate maximum prime multiplier of number
#include <iostream>
#include <inttypes.h>
#include <math.h>
using namespace std;
uint64_t maxPrimeMul (uint64_t num);
bool isPrime (uint64_t num);
int main () {
uint64_t num; // = 600851475143;
@Envek
Envek / README
Created August 14, 2011 03:07
Demo page for interaction between HTML5 and SVG.
Demo page, shows interaction between HTML page and embedded SVG.
Browsers with SVG support (incomplete list): IE 9+, Opera 8+, Firefox 1.5+, Chrome
Due to 'same origin policy' in modern browsers, it's recommended to run web server. For example, run 'python -m SimpleHTTPServer' from this directory and visit http://localhost:8000/
For converting SVG to PNG, I recommend to use "rsvg-convert" command from "librsvg2-bin" package. Run in console something like this: cat map.svg | rsvg-convert > map.png
@Envek
Envek / photo-touch.rb
Created May 8, 2012 02:45
Script for changing photo creation timestamp (in EXIF metadata and filesystem) in all jpeg's in current directory.
#!/usr/bin/ruby
# encoding: utf-8
#
# Script for changing photo creation timestamp (in EXIF metadata and filesystem)
# If you're using rvm, please run script as `ruby photo-touch.rb`
# Tested in ruby-1.9.3-p125 and ree-1.8.7-2012.02
#
# Install ExifTool: http://www.sno.phy.queensu.ca/~phil/exiftool/install.html
#
# You need next gems for script to work (use gem install gem_name)
@Envek
Envek / test_8217.rb
Created April 11, 2013 04:41
Test case for issue rails/rails#8217
unless File.exists?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'sqlite3'
GEMFILE
system 'bundle'
end
@Envek
Envek / status2tv.sh
Last active December 19, 2015 05:49
Script for creating videos from printed html page. Each printed page — separate videofile.
#!/bin/bash
# Beautiful script, that creates videos from printed html.
# Authors: Andrey Novikov, Olga Kosolapova, Timofey Karev
# Distributed AS IS under terms of MIT License
#
# Required packages:
# wkhtmltopdf : ~> 0.11.rc1
# imagemagick :
# libav || ffmpeg : (with mpeg2video codec)