Skip to content

Instantly share code, notes, and snippets.

View drakmail's full-sized avatar
🇦🇷
Working

Alex Maslov drakmail

🇦🇷
Working
View GitHub Profile
class Handlers
constructor: ->
@handlers = {}
register: (handler, registered_class) ->
@handlers[handler] = registered_class
instantiate: (handlers, element) ->
handlers = handlers.replace(/\s/g, '').split(',')
element.handlers = []
# Sends reminders to issue assignees
# Available options:
# * :days => how many days in the future to remind about (defaults to 7)
# * :tracker => id of tracker for filtering issues (defaults to all trackers)
# * :project => id or identifier of project to process (defaults to all projects)
# * :users => array of user ids who should be reminded
def self.reminders(options={})
days = options[:days] || 7
project = options[:project] ? Project.find(options[:project]) : nil
tracker = options[:tracker] ? Tracker.find(options[:tracker]) : nil
{
'packages': {
'groups': ['KDE', 'Gnome', 'minimal'],
'else': ['inkscape', 'gimp', 'firefox']
},
'timezone': 'Europe/Moscow',
'users': {
'root': {'password': 'asdf'},
'rogvold': {'password': 'qwerty',
'full_name': 'Rogaboru Kujimoshi',
wget -O chruby-0.3.4.tar.gz https://github.com/postmodern/chruby/archive/v0.3.4.tar.gz
tar -xzvf chruby-0.3.4.tar.gz
cd chruby-0.3.4
PREFIX=$HOME/chruby make install
echo 'source ~/chruby/share/chruby/chruby.sh' >> ~/.bash_login
git clone git://github.com/sstephenson/ruby-build.git ~/chruby-0.3.4/ruby-build
cd ~/chruby-0.3.4/ruby-build
PREFIX=$HOME/chruby ./install.sh
~/chruby/bin/ruby-build 2.0.0-p0 ~/.rubies/2.0.0-p0
echo 'chruby 2.0.0-p0' >> ~/.bash_login
@drakmail
drakmail / gist:5476161
Created April 28, 2013 07:08
Определение пола на ruby. Использование - detect_gender_by_given_name("Имя", "Фамилия", "Отчество").
# -*- coding: utf-8 -*-
FEMININE = 0
MASCULINE = 1
UNDEF = -1
MASCULINE_NAMES = %w[Аба Азарья Акива Аккужа Аникита Алёша Андрюха Андрюша Аса Байгужа
Вафа Ваня Вася Витя Вова Володя Габдулла Габидулла Гаврила Гадельша
Гайнулла Гайса Гайфулла Галиулла Гарри Гата Гдалья Гийора Гиля Гошеа
Данила Джиханша Дима Зайнулла Закария Зия Зосима Зхарья Зыя Идельгужа
#!/bin/sh
HERE=0
while [ 1 -eq 1 ]; do
hcitool info 54:9B:12:9B:9E:0D > /dev/null
MAG=$?
hcitool info F4:9F:54:4F:6F:23 > /dev/null
V1RUS=$?
if [ $V1RUS -eq 0 -o $MAG -eq 0 ] ; then
echo "HE IS HERE"
@drakmail
drakmail / remove_background.sh
Created October 29, 2012 15:52
remove white background with imagemagick
convert "$1" -bordercolor white -border 1x1 \
-alpha set -channel RGBA -fuzz 20% \
-fill none -floodfill +0+0 white \
-shave 1x1 $2
@drakmail
drakmail / .bashrc
Created September 18, 2012 10:10
Nice PS1 for bash
# Check for an interactive session
[ -z "$PS1" ] && return
alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '
bash_prompt() {
local NONE="\[\033[0m\]" # unsets color to term's fg color
cat /usr/share/uwsgi/conf/default.ini
# User-made changes in this file will be silently lost, as it is silently
# rewrited with upgrade of uwsgi package.
#
# If you want to change default options of uWSGI daemon, then:
# * copy this file somewhere
# * add/remove/change options in copied file
# * edit /etc/default/uwsgi and change location of inherited configuration
# file to path to copied file
iostat -x
Linux 2.6.32-5-amd64 (d-hc.ru) 08/24/2012 _x86_64_ (8 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
1.14 0.00 0.25 1.89 0.00 96.72
Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util
sda 4.38 21.96 1.80 15.62 729.42 298.68 59.05 0.63 36.34 14.34 24.97
sdb 3.86 21.95 2.36 15.62 733.11 298.68 57.36 0.54 30.29 12.87 23.14
md0 0.00 0.00 0.00 0.00 0.00 0.02 7.98 0.00 0.00 0.00 0.00