четверг, 15 января 2015 г.

Gentoo, updating GCC to newer version

If you are upgrading GCC then you do not need to do anything except switch compiler version and rebuild libtool:
root # emerge -u sys-devel/gcc
root # gcc-config -l
[1] i686-pc-linux-gnu-4.4.5 *
[2] i686-pc-linux-gnu-4.5.3

root # gcc-config 2
root # env-update && source /etc/profile
root # emerge --oneshot libtool

If you upgrade GCC from a version earlier than 3.4.0 (for the 3.x series) or 4.1, you will need to run revdep-rebuild as well:
root # revdep-rebuild --library libstdc++.so.5

Check the current version and uninstall the old version
root # gcc --version
root # emerge -C =sys-devel/gcc-4.4.5
There you go. Enjoy the new compiler!

пятница, 14 ноября 2014 г.

Debian 7 installing oracle jdk 7

echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
apt-get update
apt-get install oracle-java7-installer

четверг, 30 октября 2014 г.

Copying perl modules from one server to another

I had to deploy whole infrastructure on new server and I had to install all perl modules as it was on my dev server.
To do this, we need to generate list of all installed modules.
run
perl -MCPAN -eautobundle
This finds all installed modules and their distribution name, then stored these information in a snapshot file. When this is finished, the final messages shows
Wrote bundle file
 /root/.cpan/Bundle/Snapshot_2014_10_30_00.pm
now, copy this file into new server under /root/.cpan/Bundle/Snapshot_2014_10_30_00.pm
then just run
perl -MCPAN -e 'install Bundle::Snapshot_2014_10_30_00'
this will install all modules from this snapshot

PROFIT!!

вторник, 27 мая 2014 г.

Продлеваем обновления для Windows XP на 5 лет

8 апреля 2014 года в мире высоких технологий случилось страшное — Microsoft наконец официально прекратила поддержку своей самой популярной операционной системы Windows XP. Операционная система осталась без заплаток для угроз нулевого дня, миллионы пользователей оказались в опасности заражения вирусами. Тем не менее, далеко не все спешат переходить на новые версии как этого желает софтверный гигант — кому-то жалко денег, кто-то привык к до боли знакомому интерфейсу и нескучной обоине с зелеными холмами. Намного серьезнее все обстоит в корпоративной среде, где на Windows XP работают тысячи машин, обновление которых выльется в миллионные траты и непредвиденные проблемы с годами отточенным корпоративным софтом.

Но оказывается, что есть простой хак, который позволяет продлить получение обновлений для системы безопасности Windows XP на ближайшие пять лет, т.е. до апреля 2019 года!

Это стало возможным благодаря существованию особой версии WIndows XP — Windows Embedded POSReady. Эта система была выпущена в 2009 году и основана на Windows XP Service Pack 3. Она предназначена для различных POS-терминалов, киосков, систем самообслуживания. Пользователям Windows XP не разрешается напрямую установить эти обновления для своей операционной системы. Однако, есть способ заставить систему делать это просто добавив определенный ключ в реестр Windows.

Открываем новый файл в теплом ламповом блокноте, забиваем три строчки, сохраняем с расширением .reg и запускаем с правами администратора:

Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\WPA\PosReady] "Installed"=dword:00000001

Поскольку расширенная поддержка Windows Embedded POSReady 2009 заканчивается только через 5 лет, Microsoft будет продолжать предоставлять новые обновления безопасности и исправления для этой версии до 9 апреля 2019 года, так что пользователи могут использовать этот хак для получения обновлений безопасности Windows XP еще на пять лет вперед.

DISCLAIMER

В связи с буйством различных антипиратских инициатив в нашем мире и стране, может внезапно оказаться, что данный трюк карается как раз 5 годами тюрьмы :) Поэтому, решать вам.

Источник: http://habrahabr.ru/post/200260/
Скопипащено воизбежании потери столь ценной информации... 

ps1; В хакере пишут, что x64 версию тоже можно обновить апдейтами от Win Server 2003.
ps2; Есть шанс, что какое-нибудь критическое обновление превратит вашу Windows XP Service Pack 3 в POS-терминал. :)

вторник, 18 марта 2014 г.

Copy.com init.d script for console sync

I'm testing new cloud storage Copy.com. This service has console client for Linux and it is great for backup stuff. If you register with this link, you will get 20Gigs of space.

Now. Copy.com provides only linux binaries with no init.d script. We can create our own:

#!/bin/sh
### BEGIN INIT INFO
# Provides:          CopyAgent
# Required-Start:    $local_fs $network
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: CopyAgent
# Description:       CopyConsole (Copy cloud storage by Barracuda) service
### END INIT INFO

RUN_AS="root"
HOME=`grep $RUN_AS /etc/passwd | cut -d":" -f6`
CC="$HOME/copy/x86/CopyConsole"

start() {
   echo "Starting CopyConsole..."
       if [ -x $CC ]; then
           start-stop-daemon -b -o -c $RUN_AS -S -u $RUN_AS -x $CC -- -daemon
       fi
}

stop() {
   echo "Stopping CopyConsole..."
       if [ -x $CC ]; then
           start-stop-daemon -o -c $RUN_AS -K -u $RUN_AS -x $CC
       fi
}

status() {
       dbpid=`pgrep -u $RUN_AS CopyConsole`
       if [ -z $dbpid ] ; then
           echo "CopyConsole for user $RUN_AS: not running."
       else
           echo "CopyConsole for user $RUN_AS: running (pid $dbpid)"
       fi
}

case "$1" in

   start)
       start
       ;;
   stop)
       stop
       ;;
   restart|reload|force-reload)
       stop
       start
       ;;
   status)
       status
       ;;
   *)
       echo "Usage: /etc/init.d/copy.com {start|stop|reload|force-reload|restart|status}"
       exit 1

esac

exit 0

Do now forget to setup proper user to run from and check your installation path in CC property.

четверг, 6 марта 2014 г.

Upload .ipa to TestFlight from console

Add this code, filled out with your own TestFlight info, after the export DEVELOP_DIR line:
# testflight stuff
API_TOKEN=<YOUR API TOKEN>
TEAM_TOKEN=<YOUR TEAM TOKEN>

Add this to the end of the existing script:
#
# Send to TestFlight
#
/usr/bin/curl "http://testflightapp.com/api/builds.json" \
  -F file=@"${IPA_DIR}/${PROJECT}.ipa" \
  -F dsym=@"${IPA_DIR}/${PROJECT}.dSYM.zip" \
  -F api_token="${API_TOKEN}" \
  -F team_token="${TEAM_TOKEN}" \
  -F notes="Build ${BUILD_NUMBER} uploaded automatically from Xcode. Tested by Chuck Norris" \
  -F notify=True \
  -F distribution_lists='all'
 
echo "Successfully sent to TestFlight"

Source from: Beginning Automated Testing With Xcode Part 2/2

понедельник, 3 марта 2014 г.

Mac OS X: Create user, Create group, Add user to group, Change password from terminal

List existing group IDs in numerical order to choose an unused one for new group :-
$ dscl . -list /Groups PrimaryGroupID | awk '{print $2}' | sort -n
Create the new group 'newgroup' and assign it an ID :-
$ sudo dscl . -create /Groups/newgroup
$ sudo dscl . -create /Groups/newgroup PrimaryGroupID 1000
View the new group :-
$ dscl . -read /Groups/newgroup
AppleMetaNodeLocation: /Local/Default
GeneratedUID: 423AF02C-F053-41E0-ABCD-33127EF9A9CA
PrimaryGroupID: 1000
RecordName: newgroup
RecordType: dsRecTypeStandard:Groups
List existing user IDs in numerical order to choose an unused one for new user :-
$ dscl . -list /Users UniqueID | awk '{print $2}' | sort -n
Create the new user 'newuser' and assign various attributes :-
$ sudo dscl . -create /Users/newuser
$ sudo dscl . -create /Users/newuser UserShell /bin/bash
$ sudo dscl . -create /Users/newuser RealName "New User"
$ sudo dscl . -create /Users/newuser UniqueID "1000"
$ sudo dscl . -create /Users/newuser PrimaryGroupID 1000
View the new user :-
$ dscl . -read /Users/newuser
AppleMetaNodeLocation: /Local/Default
GeneratedUID: 47D6D841-C7F1-4962-9F7E-167E8BFC3A91
PrimaryGroupID: 1000
RealName:
 Application
RecordName: newuser
RecordType: dsRecTypeStandard:Users
UniqueID: 1000
UserShell: /usr/bash 
Add user to existing group :-
$ sudo dscl . -append /Groups/newgroup GroupMembership newuser
Change user password :-
$ sudo dscl . passwd /Users/newuser PASSWORD

Mac OS X: Enabling vnc remote management from console

If you have only ssh access, you can enable vnc server from shell, just run this:

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -restart -agent -privs -all -allowAccessFor -allUsers -clientopts -setvncpw -vncpw 123pass -setvnclegacy -vnclegacy yes
this command will enable vnc with password 123pass

четверг, 20 февраля 2014 г.

[ANTHILL] Get Project's workflows method

There is 4 methods:
<Project>.getWorkflowArray() -- returns all active workflows
<Project>.getCompleteWorkflowArray() -- returns all workflows, including inactive
<Project>.getOriginatingWorkflowArray() -- returns all active originating workflows
<Project>.getNonOriginatingWorkflowArray() -- returns all active non-originating workflows

Just a note :)

понедельник, 3 февраля 2014 г.

среда, 29 января 2014 г.

Sony Vaio SVE11/SVE14/SVE15/SVE17, Drivers, Windows 7

 Ноутбуки  SVE11, SVE14, SVE15, SVE17 собраны практически на одинаковой элементной базе, не смотря на разницу в диагонали от 11 до 17 дюймов. Разница в между моделями лишь:
- адаптере видеокарты AMD Radeon HD или  Intel® HD Graphics
- Wi-FI  Atheros или Intel
- Atheros Bluetooth или  Intel Bluetooth

При установке драйверов и софта необходимо соблюдать строгую последовательность!!! Это важно!

Порядок утановки:
1. Chipset Driver (Intel).exe
1.1. Intel® 7 Series Chipset Family SATA AHCI Controller.exe
1.2. Intel® USB 3.0 Driver.exe
1.3. Intel® Management Engine Interface Driver.exe
2. AMD Radeon HD Graphics Driver.exe
2.1. Intel® Wireless Display Driver.exe
2.2. Intel® HD Graphics driver2.exe
3. Realtek High Definition Audio Driver.exe
3.1. Audio Driver Registry Patch.exe
4. Atheros Bluetooth® Adapter.exe
4.1. Intel Bluetooth Driver.exe
5. Atheros Wireless Network Adapter.exe
5.1. Wireless Lan Driver (Intel).exe
5.2 Wi-FI Direct Support.exe
6. Realtek PCIe GBE Family Controller.exe
6.1. RealtekEthernetDriver.zip
7. Realtek PCIE CardReader.exe
8. Synaptics PS-2 Port TouchPad.exe
9. VAIO Location Utility.exe
10. Sony Firmware Extension Parser Device.exe
11. Sony Shared Library.exe
12. Hotkey Utilities.exe
13. VAIO Smart Network.exe

Качать драйвера и софт с сайта Sony India: http://www.sony.co.in/support/download/501504
Либо с ru сайта: http://www.sony.ru/support/ru/product/SVE14A1S1RB/updates
Найти нужную модель можно тут: http://www.sony.ru/support/ru/hub/NOTEBOOK

#Drivers, #SonyVaio, #Windows7

четверг, 16 января 2014 г.

[Linux] Setting up Oracle JRE on linux system

Quick HowTo set up oracle java runtime engine:
  1. download Oracle JRE tarball from Oracle Java SE Downloads 
  2. make dir/copy to/cd to for java:
    mkdir -p /usr/java/latest && cp ./jre* /usr/java/latest && cd /usr/java/latest
  3. unpack: tar zxvf jre*
  4. setup alternatives:
    update-alternatives --install "/usr/bin/java" "java" "/usr/java/latest/jre1.7.0_<version>/bin/java" 1
  5. setup this java version active:
    update-alternatives --set java /usr/java/latest/jre1.7.0_<version>/bin/java
  6. check it:
    java -version
  7. PROFIT!!1!11

вторник, 24 декабря 2013 г.

Installing ejabberd from sources

wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
dpkg -i erlang-solutions_1.0_all.deb
apt-get update

apt-get install make gcc git libyaml-dev libexpat1-dev libssl erlang

git clone https://github.com/processone/ejabberd

cd ejabberd

./configure --enable-odbc
make

make install

These commands will:
 - Install the configuration files in /etc/ejabberd/
 - Install ejabberd binary, header and runtime files in /lib/ejabberd/
 - Install the administration script: /sbin/ejabberdctl
 - Install ejabberd documentation in /share/doc/ejabberd/
 - Create a spool directory: /var/lib/ejabberd/
 - Create a directory for log files: /var/log/ejabberd/

вторник, 22 октября 2013 г.

Virtual Box Console commands

As something of a follow-up post to the previous entry, here’s a quick recipe for creating a Virtual Machine using the VirtualBox command line tools:

We’re using Windows Server 2008 64bit as an example, modify to taste.

$ VM='Windows-2008-64bit'

Create a 32GB “dynamic” disk.

$ VBoxManage createhd --filename $VM.vdi --size 32768

You can get a list of the OS types VirtualBox recognises using:

$ VBoxManage list ostypes

Then copy the most appropriate one into here.

$ VBoxManage createvm --name $VM --ostype "Windows2008_64" --register

Add a SATA controller with the dynamic disk attached.

$ VBoxManage storagectl $VM --name "SATA Controller" --add sata \
> --controller IntelAHCI
$ VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 \
> --device 0 --type hdd --medium $VM.vdi

Add an IDE controller with a DVD drive attached, and the install ISO inserted into the drive:

$ VBoxManage storagectl $VM --name "IDE Controller" --add ide
$ VBoxManage storageattach $VM --storagectl "IDE Controller" --port 0 \
> --device 0 --type dvddrive --medium /path/to/windows_server_2008.iso

Misc system settings.

$ VBoxManage modifyvm $VM --ioapic on
$ VBoxManage modifyvm $VM --boot1 dvd --boot2 disk --boot3 none --boot4 none
$ VBoxManage modifyvm $VM --memory 1024 --vram 128
$ VBoxManage modifyvm $VM --nic1 bridged --bridgeadapter1 e1000g0

Configuration is all done, boot it up! If you’ve done this one a remote machine, you can RDP to the console via vboxhost:3389.

$ VBoxHeadless -s $VM

Once you have configured the operating system, you can shutdown and eject the DVD.

$ VBoxManage storageattach $VM --storagectl "IDE Controller" --port 0 \
> --device 0 --type dvddrive --medium none

Finally, it’s a good idea to take regular snapshots so that you can always revert back to a known-good state rather than having to completely re-install.

$ VBoxManage snapshot $VM take <name of snapshot>

And, if you need to revert back to a particular snapshot:

$ VBoxManage snapshot $VM restore <name of snapshot>

Enjoy!

Readline shortcuts

Readline shortcuts

GNU Readline is the library used to make advanced command-line wizardry convenient and conistent across a multitude of command-line applications. These programs include bash, bc, ftp, gnuplot, gpg, ksh, mysql, psql, python, smbclient, xmllint and zsh.
The cheatsheet at the right contains a summary of many of the useful line editing command shortcuts which are available in all applications that use libreadline.
See the documentation on the Readline website for even more shortcuts with more elaborate descriptions.

Emacs keys Action Scope Direction/Place
Moving around Ctrl-b Move the cursor one character ⇦ to the left
Ctrl-f Move the cursor one character ⇨ to the right
Alt-b Move the cursor one word ⇦ to the left
Alt-f Move the cursor one word ⇨ to the right
Ctrl-a Move the cursor ⇤ to the start of the line
Ctrl-e Move the cursor ⇥ to the end of the line
Ctrl-x-x[1] Move the cursor ⇤⇥ to the start, and to the end again
Cut, copy
and paste
Backspace Delete the character ⇦ to the left of the cursor
DEL
Ctrl-d
Delete the character underneath the cursor
Ctrl-u Delete everything ⇤ from the cursor back to the line start
Ctrl-k Delete everything ⇥ from the cursor to the end of the line
Alt-d Delete word ⇨ untill before the next word boundary
Ctrl-w Delete word ⇦ untill after the previous word boundary
Ctrl-y Yank/Paste prev. killed text at the cursor position
Alt-y Yank/Paste prev. prev. killed text at the cursor position
History Ctrl-p Move in history one line ⇧ before this line
Ctrl-n Move in history one line ⇩ after this line
Alt-> Move in history all the lines ⇩ to the line currently being entered
Ctrl-r Incrementally search the line history ⇧ backwardly
Ctrl-s[2] Incrementally search the line history ⇩ forwardly
Ctrl-J End an incremental search
Ctrl-G Abort an incremental search and restore the original line
Alt-Ctrl-y Yank/Paste arg. 1 of prev. cmnd at the cursor position
Alt-.
Alt-_
Yank/Paste last arg of prev. cmnd at the cursor position
Undo Ctrl-_
Ctrl-x
Ctrl-u
Undo the last editing command; you can undo all the way back to an empty line
Alt-r Undo all changes made to this line
Ctrl-l Clear the screen, reprinting the current line at the top
Ctrl-l Clear the screen, reprinting the current line at the top
Completion TAB Auto-complete a name
Alt-/[3] Auto-complete a name (without smart completion)
Alt-? List the possible completions of the preceeding text
Alt-* Insert all possible completions of the preceeding text
Transpose Ctrl-t Transpose/drag char. before the cursor ↷ over the character at the cursor
Alt-t Transpose/drag word before the cursor ↷ over the word at/after the cursor

вторник, 8 октября 2013 г.

Installing b43 wireless on ubuntu

Download this:
http://downloads.openwrt.org/sources/wl_apsta-3.130.20.0.o
and
http://mirror2.openwrt.org/sources/broadcom-wl-4.150.10.5.tar.bz2
Copy them into your installation flashdrive
Install b43-fwcutter from /cdrom/pool/main/b/ there will be .deb package
Than:

tar -xjvf broadcom-wl-4.150.10.5.tar.bz2
sudo b43-fwcutter -w /lib/firmware wl_apsta-3.130.20.0.o
sudo b43-fwcutter --unsupported -w /lib/firmware broadcom-wl-4.150.10.5/driver/wl_apsta/wl_prebuilt.o
sudo chmod 775 /lib/firmware/b43
sudo chmod 775 /lib/firmware/b43legacy
sudo modprobe -r b43
sudo modprobe b43

Thats it :) Works on Ubuntu 13.04

пятница, 4 октября 2013 г.

Sphinx on Gentoo

# Обновить portage
emerge --sync
emerge portage

# Установить sphinx
USE="debug id64 mysql -postgres stemmer test" emerge app-misc/sphinx

# Скопировать или переименовать конфигурационный файл
cd /etc/sphinx
cp sphinx.conf.dist sphinx.conf

# Настроить разрешения, чтоб группа web могла редактировать конфигурационный файл
chmod 664 /etc/sphinx/*
chown root:web /etc/sphinx/*

# Добавить пользователя и группу sphinx
groupadd -g 494 sphinx
useradd -g sphinx -u 494 -d /var/lib/sphinx -s /bin/bash -c "Sphinx server" sphinx

# Создать папки, где будут храниться логи, pid-файлы и данные
mkdir -p /var/log/sphinx
mkdir -p /var/run/sphinx
mkdir -p /var/lib/sphinx/data

# Настроить правильные разрешения на эти папки
chown sphinx:sphinx /var/log/sphinx
chown -R sphinx:sphinx /var/lib/sphinx
chown sphinx:sphinx /var/run/sphinx

# Добавить в /etc/sudoers что-то типа
%web ALL=NOPASSWD:/etc/init.d/searchd
%web ALL=(sphinx) NOPASSWD:/usr/bin/indexer

# Проверить от пользователя группы web
sudo -u sphinx /usr/bin/indexer
sudo /etc/init.d/searchd restart|stop|start

# Установить расширения php
PHP_TARGETS="php5-4" emerge pecl-sphinx

Так же  пришлось немного подправить init скрипт, чтобы запускать свинкс от моего пользователя