Gudasoft

Impossible is nothing

Increment all serial numbers at once for bind

Increment all serial numbers at once in a named/bind dns zone file.
Just run the script in the current directory /etc/bind/namedb and all serial numbers will be incremented by one.


#!/usr/bin/ruby

Dir.glob("*.db") do |file_name|
  new_zone = []
  File.open(file_name) do |file|
    while (line = file.gets)
        line.chomp!
        if line =~ /Serial/
          line =~ /(\s*?)(\d+)(\s*?)(;.*)/
          serial = $2.to_i
          serial += 1
          puts "#{file_name} serial line:  #{$1} #{$2} #{$3} #{$4} -> #{$1}#{serial}#{$3}#{$4}"
          line = "#{$1}#{serial}#{$3}#{$4}"
        end
        new_zone << line
    end
  end
  new_zone << "\n"

  File.open(file_name, "w") do |new_file|
    new_file.write(new_zone.join("\n"));
  end
end

Benchmark memcached for reading different variables

require 'benchmark'
require 'ostruct'
Rails.logger.level = 1
n = 100000

Benchmark.bm do |x|
  x.report("10 variables") do
    a, b, c, d, e, f, g, e, h, m = [1, 2, 3, 4, 5, '6', '7', '8', '9', '10']
    Rails.cache.write('a', a)
    Rails.cache.write('b', b)
    Rails.cache.write('c', c)
    Rails.cache.write('d', d)
    Rails.cache.write('e', e)
    Rails.cache.write('f', f)
    Rails.cache.write('g', g)
    Rails.cache.write('e', e)
    Rails.cache.write('h', h)
    Rails.cache.write('m', m)

    n.times do
      a = Rails.cache.read('a')
      b = Rails.cache.read('b')
      c = Rails.cache.read('c')
      d = Rails.cache.read('d')
      e = Rails.cache.read('e')
      f = Rails.cache.read('f')
      g = Rails.cache.read('g')
      e = Rails.cache.read('e')
      h = Rails.cache.read('h')
      m = Rails.cache.read('m')
    end
  end

  x.report("hash with 10 variables") do
    hash = {
      'a' => 1,
      'b' => 2,
      'c' => 3,
      'd' => 4,
      'e' => 5,
      'f' => '6',
      'g' => '7',
      'e' => '8',
      'h' => '9',
      'm' => '10'
    }
    Rails.cache.write('hash', hash)

    n.times do
      hash = Rails.cache.read('hash')
    end 

  end

  x.report("array with 10 variables") do
    array = [
      ['a', 1],
      ['b', 2],
      ['c', 3],
      ['d', 4],
      ['e', 5],
      ['f', '6'],
      ['g', '7'],
      ['e', '8'],
      ['h', '9'],
      ['m', '10'],
    ]
    Rails.cache.write('array', array)

    n.times do
      array = Rails.cache.read('array')
    end 

  end

end

user system total real
10 variables 42.670000 8.200000 50.870000 ( 52.095375)
hash with 10 variables 6.390000 0.810000 7.200000 ( 7.303731)
array with 10 variables 6.350000 0.820000 7.170000 ( 7.279306)

Opel Zafira 2007 reset InSP

- Натисни бутон А
- Задръж А докато се появи надписа за сервиз
- Продължавай да държиш бутона
- Натисни спирачка и дай контакт
- InSP ще се появи на екранчето
- След 10 сек. новият интервал ще се покаже
- Пусни А, спирачката и махни контакта

- Натисни бутон А- Задръж А докато се появи надписа за сервиз- Продължавай да държиш бутона- Натисни спирачка и дай контакт- InSP ще се появи на екранчето- След 10 сек. новият интервал ще се покаже- Пусни А, спирачката и махни контакта

1rip.com ban ip list

If you have a lot of requests you can use this list of IP address to ban with iptables the entire (almost) set of machines

http://pastie.org/8102773

You have to secure your dns server.

Activeadmin

If you plan to use activeadmin you have to be warned that  by using active admin you are supporting two back ends – yours and the one for active admin.
So if you have time to work for someone else go with active admin. else just do it your self.
Don’t use it!
There is one rumor that nothing starting with active* was good product. ActiveDirectory for ActiveX…. I was wondering are there exceptions ActiveSupport, ActiveRecord….

Jailbrake iphone 4 with ios7

I am the jailbreaking because I feel that my device is my responsibility and I have all rights on it. I don’t wish some company to restrict me what to do or not to do.

My initial setup was iphone 4 with ios 4.1.something.
I used itunes to upgrade to ios 7.1.2
then I used pangu to jailbrake but while installing cydia I lost all icons on my iphone.

Again I used itunes to reinstall ios 7.1.2 but then I use several times the reset/delete/restore options in the iphone settings menu.

Then I followed the steps http://www.lovemediasoft.com/article/bg/jailbreak-ios-7-1-x-pangu-1-1-windows.html and everthing was OK.

When cydia was installed I installed

to access the iphone over usb you need APPLE FILE CONDUIT “2” – is newer than afc2add – I am testing it right now..
AppSync Unified – you need this to install unsinged ipa files.
FlipControlCenter

Simple, right? I took me 2 nights to do all those stupid things in order to have MY phone MINE!

last time it took me again 2 nights those 4 nights are a lot of lost money and I wish apple to pay for them.

Here is the list of the programs that I use
Activator – shortcuts
OpenSSH
PasswordPilot – inserts your apple password automatically

Tried but not using
vShare
AppCake
LocallApStore
iFile

List of domains that do url shortening

0rz.tw

1url.com

2.gp

3.ly

7.ly

a.gg

adf.ly

alturl.com

amzn.to

atu.ca

azc.cc – bit.ly

bcool.bz – bit.ly

bit.ly

chilp.it

cl.ly

clck.ru

cli.gs

cort.as

crks.me – bit.ly

cutt.us

digbig.com

doiop.com

easyurl.net

fbshare.me

firsturl.de

firsturl.net

go.ign.com – bit.ly

go.usa.gov

goo.gl

blankrefer.com

hurl.me

ilix.in

is.gd

ix.lt

j.mp – bit.ly

korta.nu

l9k.net

liip.to

linkbun.ch

merky.de

migre.me

miniurl.com

minu.me

myurl.in

nsfw.in

nutshellurl.com

nxy.in

ow.ly

ptiturl.com

ri.ms

rww.tw – bit.ly

safe.mn

shorl.com

shorturl.comalturl.com

shrt.fr

smsh.me

sp2.ro

tw.gs

0l.ro

2u.lc

3le.ru

888.hn

b54.in

cut.by

dft.ba

durl.me

joi.nu

lxcurl.com

mcaf.ee

rod.gs

s.coop

surl.me

tiny.cc

tinyurl.com

surl.co.uk

to.ly

twt.fi

ux.nu

v.gd

va.mu

vai.la

x.co

x.nu

ta.gd

tgr.ph – bit.ly

tiny.pl

tinylink.in

togoto.us

ur1.ca

url.ie

urls.im – bit.ly

urlshorteningservicefortwitter.com

x.vu

xrl.us

xurl.es

yep.it

zi.ma

.ws

.ws

.ws

.ws

.ws

.ws

.ws

.ws

.ws

.ws

.ws

Replacement for tilda guake or other not working solutions

This script will activate gnome-terminal when you press INSERT (the key right to backspace) and will hide it when pressed again.

Using this script is better than tilda or guake or whatever because you can resize the terminal. You can clean the terminal and have all goods you have in normal terminal.

To install it under lubuntu/lxde open ~/config/openbox/lubuntu-rc.xml and add

https://gist.github.com/gudata/4065ad9bb1fd6d82933b

Here is the code for the riseterminal.sh

#/bin/bash
XDO=/usr/bin/xdotool

#TERMINAL_ID=`$XDO  search --name Terminal | /usr/bin/tail -1`

raise_or_fall () {
  TERMINAL_ID=$($XDO search --class gnome-terminal | /usr/bin/tail -1)
  CURRENT_WINDOW_ID=`$XDO getwindowfocus`

  WIDS=`$XDO search --onlyvisible --class gnome-terminal`

  if [ "$CURRENT_WINDOW_ID" -eq "$WIDS" ]
  then
    # zenity --question --text="down"
    $XDO windowminimize $TERMINAL_ID
  else
    # zenity --question --text="up"
    # $XDO windowraise $TERMINAL_ID
    # $XDO windowfocus --sync $TERMINAL_ID
     $XDO windowactivate $TERMINAL_ID
  fi
}

if `ps aux | grep "[g]nome-terminal" > /dev/null`
then
  raise_or_fall
else
  gnome-terminal &
fi

Dental Master Pro

Изглежда програмата Dental Master Pro работи и на Windows 7 ULT SP1-64bit и Windows 8-64bit

Просто трябва да зададете опцията за съвместост с Windows XP SP3 на изпълнимият файл и сте готови.

Благодарностите отиват при Д-р Роси Колева.

Working with Rails as a designer

Installing Rails

You have to install first ruby, rubygems, git, bundle, rails

Installing ruby

Preferable way is to install it with normal user via rvm. I am not an expert in mac so probably you need to install xcode from your disks/Internet. Then use rvm

Here is a one of the many tutorials http://www.shanison.com/2011/02/20/how-to-install-rvm-on-mac/

here are other ways for installing ruby taken from Ruby on Rails for Designers

Installing rubygems

Download, extract and run ruby setup.rb

more reading here http://docs.rubygems.org/read/chapter/3

Checkout the project

One SCM is git. install it

http://git-scm.com/book/en/Getting-Started-Installing-Git

Then checkout it

git clone ssh://par@gudasoft.com/uppstart

Starting Rails project

go to the project folder you have checkout already.

cd uppstart

rvm will ask you if you trust the version of ruby specified in the project. Please agree and install it if you don’t have it.

installing is done by

rvm install ruby-what-ever-version

then you have to install bundle. This is done by doing

gem install bundler

After you have install bundler you will have the bundle command available. Bundler will try to install all the project dependencies. do this by typing

bundle

if you don’t have errors you will be almost ready to run the application.

check in config/database.yml and prepare the database specified in the development section

cat config/database.yml

If you see in development sqlite3 as an adapter then just type

rake db:setup

start the application by running

rails s

check the app by navigating to http://localhost:3000

Views

All views are located under app.

Files starting with underscore are partials which are reused in multiple places.

Assets

Assets could be in several places.

check

If you want to add your own file include it under the

application.js

or

application_screen.css

Do not add css/javascript directly in those files.

Deploying the application

Put your ssh keys on the server. This should be done once.

Then you have to put your changes on the remote repository. This is done by doing

First we need to get any remote changes by doing.

git pull
git commit -a

Then we can add our new files and commit the changed files/folders.

add the new files with

git add filename_or_folder

then commit all with a message

git commit -a -m "nice message what was changed"
git push

Finally From the application folder run

cap deploy