Skip to content

Instantly share code, notes, and snippets.

Avatar

Aleksey Dmitriev dekart

View GitHub Profile
View copyChangelogRow.js
javascript:setTimeout(function(){
var m = window.location.href.match(/trello.com\/c\/[A-z\d]+\/(\d+)/);
if(m){
var text = new Date().toLocaleDateString("en-US") + "\t" +
'=HYPERLINK("'+m[0]+'","'+m[1]+'")' + "\t" +
document.querySelector('div.window-title>textarea').value;
navigator.clipboard.writeText(text);
@dekart
dekart / .gitignore
Created Feb 25, 2019
Unity Gitignore
View .gitignore
[Ll]ibrary/
[Tt]emp/
[Oo]bj/
[Bb]uild/
[Bb]uilds/
Assets/AssetStoreTools*
# Visual Studio cache directory
.vs/
@dekart
dekart / README
Last active Aug 29, 2015
Iptables setup for port forwarding on local dev machine.
View README
Should be added to /etc/network/if-pre-up.d/iptable_rules
Don't forget to run
chmod +x /etc/network/if-pre-up.d/iptable_rules
View decorator.rb
class Object
def self.my_decorator(method_name)
alias_method "#{method_name}_without_my_decorator", method_name
define_method method_name do
puts "My decorator logic starts"
result = send("#{method_name}_without_my_decorator")
puts "My decorator logic ends"
result
end
@dekart
dekart / convert_to_webp
Created Aug 9, 2013
A script to convert JPEG and PNG images in desired folders to WebP
View convert_to_webp
#!/usr/bin/env ruby
def process_folders(message, *folders, &block)
root = File.expand_path('../..', __FILE__)
puts message
puts
total_old = 0
total_new = 0
View mkv h264 aac to mp4 with selected sound track
ffmpeg -i input.mkv -map 0:0 -map 0:2 -c:v copy -c:a:0 copy output.mp4
View distribution_chips
CLAN_ID = 1
clan = Clan.find(CLAN_ID)
character_ids = ClanMember.connection.select_values(
ClanMember.send(:sanitize_sql, ["SELECT character_id FROM clan_members WHERE clan_id = :clan", :clan => clan.id])
)
position = 0
@dekart
dekart / backup.rb
Created May 28, 2013
Redis backup & restore script
View backup.rb
def backup(path, redis)
keys = redis.keys
puts "#{ keys.size } keys to dump"
File.open(path, 'w+') do |f|
keys.each_with_index do |key, i|
next unless dump = redis.dump(key)
f.puts JSON.dump([key, dump.force_encoding('utf-8')]).force_encoding('utf-8')
View my.cnf
[mysql]
# CLIENT #
port = 3306
socket = /var/lib/mysql/mysql.sock
[mysqld]
# GENERAL #
user = mysql
View rbenv_setup.sh
cd ~
curl -L https://raw.github.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash
export PATH="$HOME/.rbenv/bin:$PATH"
echo '
export RBENV_ROOT="${HOME}/.rbenv"
if [ -d "${RBENV_ROOT}" ]; then