Category Archives: How-To’s

ffmpeg on Raspbian – Raspberry Pi

First for all we need to build and install x264

# git clone --depth 1 git://git.videolan.org/x264
# cd x264
# ./configure --host=arm-unknown-linux-gnueabi --enable-static --disable-opencl
# make -j 4
# sudo make install

For mp3 support

wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.tar.gz
tar xzvf lame-3.99.tar.gz
cd lame-3.99
./configure
make
make install

For Hardware Encoding
1. add "--enable-omx --enable-omx-rpi" to ./configure options
2. compile
3. use encoder option "-c:v h264_omx"

Then build and make ffmpeg

# git clone --depth=1 git://source.ffmpeg.org/ffmpeg.git
# cd ffmpeg
# ./configure --arch=armel --target-os=linux --enable-gpl --enable-libx264 --enable-libmp3lame --enable-nonfree --enable-omx --enable-omx-rpi
# make -j4
# sudo make install
# ldconfig

It takes just 25 minutes on a Raspberry Pi 3.
In case you are wondering v4l2 should work with this.

I provide a repository for this kind of stuff some day.
git clone http://git.itunix.eu/git/x264/
git clone http://git.itunix.eu/git/ffmpeg/

Applications that I use on iPhone

I have prepared a list of applications that I use on my iPhone; the following list does not include all applications I’m using, but only those which can seem to be interesting for some of you.

Firefox

firefoxVery long-awaited iPhone app is Firefox, which is mostly valuable for its quick and easy synchronizing of browsing history, so I can continue my work on smartphone.

Inbox

inboxEasy and intuitive way to receive and send e-mails. That project has been already interesting as it was in the testing phase. I was so excited when I got an invitation to become a beta tester!

Skype

skypeI think it’s the only application that hasn’t disappointed me in video calls; I can talk for long hours without any problems.

Tweetbot 4

tweetbotOne of the best applications for Twitter. After several years they’ve even released new version for the iPad. I’d say that this application is worth the money you have to spend on it.

Telegram

telegramFor the last several months I’ve managed to persuade most of my friends to use Telegram. This app is simple, quick, grows up rapidly and seems to be safe.

Softphone

softphoneI use Softphone for few years, it hasn’t ever failed – I can frankly recommend this app as the best application for VoIP.

Lastpass

lastpassMy friend recommended me some time ago LastPass – from that moment I use it for about four years. It’s the only one program in which I keep all my passwords; I use it both on PC and iPhone. This application really makes my life easier now.

Pushover

pushoverWhen the postman passes by the letter box or washing machine finishes its work, I get push notification on my smartphone. Custom notifications for EVERYTHING – what more can be said?

eBay

ebayI don’t want to advertise eBay here, but it’s probably the only online shop, in which I can get everything I want. I use this app almost everyday.

WolframAlpha

wolframalphaThis application can calculate almost everything; on my studies it’s been the most used app ever. I’m thankful the author that he created such a powerful application.

Boxcar 2

boxcarFor a long time I had been looking for a comfortable and simple RSS reader and I finally – I found it. Boxcar is IMHO the best one – it has push notifications about new articles. I just wanna encourage you to try it.

OpenVPN Connect

openvpnWhen I’m using public hotspots, I care about my privacy – so thanks to the application OpenVPN I can safely connect to my server and use the internet just like I was at home.

Google Maps

googlemapsI owe a lot to Google Maps – this application allows me to search for a place in a foreign land (or even in my city) and not to get lost there. If it didn’t exist, I would be lost almost everyday. Thanks, Google!

Number26

number26A new, innovative bank that has more capabilities than common banks, option of fast paying and withdrawing money in groceries by bar code that you can generate in your smartphone. When you’ve got that bar code, the only thing is to give to cashier. There are also no fees for taking money from ATMs wherever you are. I would really recommend checking this bank to anyone.

CoinBase

coinbaseFor those, who are interested in Bitcoin, I can recommend CoinBase – it’s quick and easy way to buy and sell bitcoins, all you have to do ist just to connect your bank account or credit card – that’s it. Isn’t it easy?

Spotify

spotifyAs we know, everyone needs some time to relax – and music is the best way to do this. I have been using Spotify since two years and it’s the only application I use everyday for several hours. I’ve tested Apple Music, but I’d rather keep listening to music on Spotify instead of on that fruity app.

Netflix

netflixEvery single time I have, I spend on Netflix. Year ago I watched all the seasons of Dr. Who in only two weeks. No, I’m not a nolife! Maybe a bit… How much?

The Room 1,2 and 3

A wonderful puzzle game in which you can really feel the atmosphere and a great way to spend the evenings with a smartphone in your hands(no, you’re not gonna be nolife like me).

Setting up Nagios Server to Remotely Server on Debian

Step 1. Installing packages

We have one server for monitoring (eg. myoneserver). [client]

# aptitude install nagios-nrpe-server nagios-plugins

And one server to view statistics. [server]

# aptitude install nagios-nrpe-plugin nagios-plugins nagios3

Step 2. Configuring the server for monitoring [client]
Edit /etc/nagios/nrpe.conf.

# nano /etc/nagios/nrpe.conf

Set the server_address to the IP address you want NRPE to bind to on the Untangle server.  If you want it to bind to all addresses, leave this command commented out.

server_address=10.0.0.1

Change allowed_hosts to the IP address of the Nagios server:

allowed_hosts=10.0.0.20

Add a command to check the swap utilization:

command[check_sda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda1

Save and quit /etc/nagios/nrpe.conf.

Restart the NRPE service:

/etc/init.d/nagios-nrpe-server restart

Step 3. Configure the Nagios Server
Create a file named /etc/nagios3/conf.d/myoneserver.cfg with the following contents:

#Host Definition
define host{
use                     generic-host
host_name               myoneserver
alias                   MyOneServer Server
address                 10.0.0.1
}

# Service Definitions
define service{
use                     generic-service
host_name               myoneserver
service_description     CPU Load
check_command           check_nrpe_1arg!check_load
}

define service{
use                     generic-service
host_name               myoneserver
service_description     Swap Drive Usage
check_command           check_nrpe_1arg!check_swap
}

define service{
use                     generic-service
host_name               myoneserver
service_description     Free Disk Space
check_command           check_nrpe_1arg!check_sda1
}

define service{
use                     generic-service
host_name               myoneserver
service_description     Number of Users
check_command           check_nrpe_1arg!check_users
}

define service{
use                     generic-service
host_name               myoneserver
service_description     Number of Zombie Processes
check_command           check_nrpe_1arg!check_zombie_procs
}

define service{
use                     generic-service
host_name               myoneserver
service_description     Total Processes
check_command           check_nrpe_1arg!check_total_procs
}

Save and quit  /etc/nagios3/conf.d/myoneserver.cfg.

Edit /etc/nagios3/conf.d/hostgroups_nagios2.cfg and add the following section to define an

Server group. (optional)
define hostgroup {
hostgroup_name  myoneserver
alias           MyOneServer Servers
members         MyOneServer1, MyOneServer2 MyOneServer3
}

Restart the Nagios service to apply the changes:

/etc/init.d/nagios3 restart

Find and replace text in multiple files using geany

To open all files, in which a specific string is found, from inside of a directory (and subdirectories) open Geany, select Terminal tab from Message Window and run next command inside:

grep -rHIF --exclude='/home/modinfo/bitcoin/*~' -- 'text_to_find' /bin/bash /home/modinfo/bitcoin/* | geany `awk 'BEGIN {FS="[:]"} {print $1}'`

source

Quick server backup

mount /dev/xxxx -o remount-ro /mnt
tar -cvjpf serverbackup.tar.bz2 /mnt

then unpack the behavior of permissions

tar -xvjpf serverbackup.tar.bz2

here my script with mysql backup. backup.sh

  1. # create backup catalog
  2. mkdir /backup
  3. # clean
  4. aptitude clean
  5. rm /var/log/*.gz
  6. rm /var/log/apache2/*.gz
  7. rm /var/log/apt/*.gz
  8. rm /var/log/clamav/*.gz
  9. rm /var/backups/*.gz
  10. # start archive
  11. tar -cvjpf /backup/backup_bin.tar.bz2 /bin
  12. tar -cvjpf /backup/backup_home.tar.bz2 /home
  13. tar -cvjpf /backup/backup_lib.tar.bz2 /lib
  14. tar -cvjpf /backup/backup_root.tar.bz2 /root
  15. tar -cvjpf /backup/backup_usr.tar.bz2 /usr
  16. tar -cvjpf /backup/backup_etc.tar.bz2 /etc
  17. tar -cvjpf /backup/backup_lib64.tar.bz2 /lib64
  18. tar -cvjpf /backup/backup_sbin.tar.bz2 /sbin
  19. tar -cvjpf /backup/backup_var.tar.bz2 /var
  20. # backup mysql
  21. mysqldump -u root -p<PASSWORD> --all-databases > /backup/all_databases.sql
  22. # archiving of all backups to a single file
  23. tar -cvjpf /backup_`date +"%F"`.tar.bz2 /backup
  24. # send backup to another server
  25. scp /backup_`date +"%F"`.tar.bz2 user@server:/home/backup
  26. # remove local backup
  27. rm -R /backup /backup_`date +"%F"`.tar.bz2

update
backup from remote server 192.168.0.100 to local /mnt

mount /dev/sda1 /mnt/
rsync -aHxv root@192.168.0.100:/* /mnt --exclude=/dev --exclude=/proc --exclude=/sys --exclude=/tmp

Liquidsoap: AutoDJ for icecast

Wonder it’s called “Liquidsoap”. Is a piece of firmware that can really do a lot of things. What does it do? Starting play playlists, depending on the time or any logic, he can listen to Icecast or Shoutcast instead, is able to download the streams from other servers, mix them, detect or work, etc…

Configuration looks like this:

#!/usr/bin/liquidsoap
set("log.file.path","/tmp/basic-radio.log")
 
# required speech synthesizer, aptitude install festival
message = "That's it! you listening the radio dubstep is our life, listen to us at school, at home or at a party with friends"
messagesorry = "Sorry for the inconvenience, continuation of the program soon!"
 
welcome = single("say:"^message)
sorryvoice = single("say:"^messagesorry)
 
# find /home/music/ -type f -name "*.mp3" > /etc/liquidsoap/music.m3u
radio   = playlist("music.m3u")
dubstep = playlist("dubstep.m3u")
 
#play a random playlist with random music
radio   = random(weights = [1, 3, 1],[welcome, radio, dubstep])
 
#if the music not available
radio = fallback(track_sensitive=false, [radio, sorryvoice])
 
#if the live broadcast available
full = fallback(track_sensitive=false, [input.http("http://nsa310:8000/live"), radio])
 
# Stream it out (ogg)
#output.icecast(%vorbis, host = "localhost", port = 8000, password = "<PASSWORD>", mount = "/radio.ogg", full)
 
# Stream in mp3 ~Low Quality
output.icecast(%mp3(bitrate=32, samplerate=22050, stereo=false), mount="/radio-32.mp3", host="localhost", port=8000, password="<PASSWORD>", mean(full))
 
# Stream in mp3 ~High Quality
output.icecast(%mp3(bitrate=128), mount="/radio-128.mp3", host="localhost", port=8000, password="<PASSWORD>", full)

There is a lot of options to configure according to your needs, here are more examples: documentation.

Own IRC Server on Debian with Anope and MySQL

** Pre-Installation **

First, download the UnrealIRCd source, located hier

wget http://www.unrealircd.com/downloads/Unreal3.2.10.1.tar.gz
wget http://www.unrealircd.com/pgp/Unreal3.2.10.1.tar.gz.asc

After you install it, run a few checks on the gzip file to make sure it is the secured version.

gpg --keyserver keys.gnupg.net --recv-keys 0x9FF03937
gpg --verify Unreal3.2.10.1.tar.gz.asc Unreal3.2.10.1.tar.gz

Next, we have to extract the contents of the compressed file. Type

tar zxvf Unreal3.2.10.1.tar.gz

** SSL Support

If you want users to be able to connect to your IRC server via a secure connection, you will need to install a package called libcurl4-openssl-dev. This is a bundle that includes everything needed for SSL, plus what is needed for remote includes which are discussed below.

You will need to install the packages as root. Type these:

apt-get install build-essential
apt-get install openssl
apt-get install libcurl4-openssl-dev

You now have what is required for SSL connections to your server.

**Ziplinks Support

Ziplinks reduce the amount of bandwidth used by your servers by compressing data before it is sent to another server.
zlib1g is the library required for ziplinks, which is usually installed already, so you don’t have to do anything.

** Remote Includes Support

A remote include is pretty much like a normal include, the difference being that remote includes are obtained from a remote FTP server. This makes it so there could be one central FTP server with most of the configuration files that are not server-specific. This will make updates to the configuration files much easier, since you only have to update the files on the FTP server, then rehash all of the IRC servers.

For remote include support, we will need libcurl, which is already installed with the libcurl4-openssl-dev package above.

** Installation **
We are now ready to install UnrealIRCd. Switch back to the account that you will be installing UnrealIRCd on, and navigate to the Unreal3.2 folder. Type:

./Config

… answers to questions that ask configurator …
with SSL support!
And type make

** Anope **
Download Anope Services.

Decompress them
tar zxvf anope-1.8.8.tar.gz

Change to anope directory and start the installation:
cd anope-1.8.8
./Config

Configuration answers:

install binaries to? I suggest /path/to/Unreal3.2.10.1/services
create dir? yes
install data files to? hit enter
group? hit enter
default umask? hit emter
MD5 passwd encryption? no (unless you really want it)
auto-check for mysql libs? hit enter

Type make and make install to complete the compilation process
When everything is done, cd to the services directory and copy the example conf:

cd /path/to/Unreal3.2.10.1/services
cp example.conf services.conf
Open services.conf in your favorite editor and modify/add these values:
IRCDModule "unreal32"
RemoteServer 127.0.0.1 6667 "services"
ServerName "services.yourdomain.com"
ServicesRoot "YourNicknameHere"

** Configuration **
Copy the example configuration file
cd Unreal3.2.10.1/
cp doc/example.conf unrealircd.conf

Lines that start with # are my comments so you don’t have to add them to the config file.

/* FOR *NIX, uncomment the following 2lines: */
loadmodule "src/modules/commands.so";
loadmodule "src/modules/cloak.so";

Set your IRCD info:

me
{
name "irc.yourdomain.com";
info "your IRC network name";
numeric 1;
};

Show users you’re the admin

admin {
"Your Name";
"Your Nickname";
"your@email.addr";
};

Add an O:Line for yourself
You can edit the one already there
O:Lines define the IRCops

oper YourNickHere {
class clients;
from {
userhost *@*;
};
password "YourPassHere";
flags
{
netadmin;
can_zline;
can_gzline;
can_gkline;
g lobal;
};
};

Add a C/N Line for IRC Services
Don’t edit the link block already there.
C/N Lines allow other IRCDs or IRC Services to link with you

link services.itunix.eu
{
   username   *;
   hostname    192.168.0.100;
   bind-ip    *;
   port       7070;
   hub             *;
   password-connect "password";
   password-receive "password";
   class           servers;
   options {
      };
};
listen         *:6697
{
	options
	{
		ssl;
		clientsonly;
	};
};

listen *:7070
{
	options
	{
		serversonly;
	};
};
link            hub.itunix.eu
{
	username	*;
	hostname 	127.0.0.1;
	bind-ip 	*;
	port 		7029;
	hub             *;
	password-connect "password";
	password-receive "password";
	class           servers;
		options {
			/* Note: You should not use autoconnect when linking services */
			autoconnect;
			ssl;
			zip;
		};
};

You can edit the ulines block already there

ulines {
	services.itunix.eu;
	stats.itunix.eu;
};

Network configuration is the most important part
You can use the block already there

/* Network configuration */
set {
network-name "YourNetworkNameHere";
default-server "irc.yourdomain.com";
services-server "services.yourdomain.com";
stats-server "stats.yourdomain.com";
help-channel "#help";
hiddenhost-prefix "hidden";
/* prefix-quit "no"; */
/* Cloak keys should be the same at all servers on the network.
/* [..etc..]
*/
cloak-keys {
"J7hVz4Zb7x4YwpWaoAr1HnR6gl3s";
"OH877h87UGU90jioIOjhiUI898hgF";
"UHUHij89IOjiojiio8990KJBBKU898";
};
/* on-oper host */
hosts {
local "locop.yourdomain.com";
global "ircop.yourdomain.com";
coadmin "coadmin.yourdomain.com";
admin "admin.yourdomain.com";
servicesadmin "csops.yourdomain.com";
netadmin "netadmin.yourdomain.com";
host-on-oper-up "no";
};
};

Server configuration
You can edit the block already there

/* Server specific configuration */
set {
kline-address "VALID.mail@address.here";
auto-join "#lobby";
modes-on-connect "+ixw";
modes-on-oper "+xwgs";
oper-auto-join "#opers";
dns {
nameserver Your.DNS.IP.Here;
timeout 2s;
retries 2;
};

** Anope
Corrected that but in services.conf where i had:

RemoteServer 192.168.0.100 7070

MysqlHost “127.0.0.1”
MysqlUser “user”
MysqlPass “pass”
MysqlName “anope”
MysqlSock “/tmp/mysql.sock”
MysqlPort 3306

and import tables.sql to mysql

Save and close the config file
Start Anope IRC Services with debug mode enabled in order to spot:

./services -debug -nofork

If the services didn’t show any errors in the console and connected (and stayed connected) to the IRC server, it’s safe to run them normally:

./services

Start your new IRCD server by typing:

./unreal start