Thursday, November 05, 2015

rsync: copy files with a given extensions

rsync -zarv --include="*/" --include="*.h" --exclude="*" --prune-empty-dirs /home/marcin/cpp/bitmonero ./test

Tuesday, October 27, 2015

Friday, October 23, 2015

Make python 3 virtual envirnoment on Ubuntu 15.10

sudo apt-get install python3-venv python3 -m venv ~/mypy34env/ source ~/mypy34env/bin/activate And then install python packages using pip, for example, pip install ipython

Saturday, September 05, 2015

Ubuntu: vncviewer command line tool install

the vncviewer command program is in this package:sudo apt-get install xtightvncviewer to use it vncviewer with ssh tunnel: vncviewer -via remoteusername@vncserverip localhost:1

Friday, August 28, 2015

Ubuntu: vncviewer through ssh

vncviewer -via remoteusername@vncserverip localhost:1

Wednesday, August 26, 2015

Ubuntu: Start chromium in new profile / instance

chromium-browser --enable-udd-profiles --user-data-dir=~/.newchromeprofile

Sunday, August 23, 2015

Compile latest bitmonero source on Ubuntu 14.04

The gist shows how to compile latest monero source code on Ubuntu 14.04.
# The gist shows how to compile latest monero source code on
# Ubuntu 14.04
# install git
sudo apt-get install git
# install dependencies
sudo apt-get install build-essential cmake libboost1.55-all-dev libssl-dev libgtextutils-dev pkg-config libunbound-dev libevent-dev libgtest-dev graphviz doxygen libdb5.3++-dev
# get the source code of bitmonero from github
git clone https://github.com/monero-project/bitmonero.git
# compile
cd bitmonero/
cmake .
make
# copy the binaryis into /opt/bitmonero
sudo mkdir /opt/bitmonero
sudo mv ./bin/* /opt/bitmonero/
# launch the monero node demon and let it synchronize with the monero network
#/opt/bitmonero/bitmonerod
# launch the monero wallet
#/opt/bitmonero/simplewallet

Sunday, August 16, 2015

Mining monero through Tor in Ubuntu 14.04

Mining Monero through Tor can be easly done using proxychains-ng (also called proxychains4). sudo proxychains4 /opt/cpuminer-multi/minerd -a cryptonight -o stratum+tcp://mine.moneropool.com:3333 -u YOUR_WALLET_ADDRESS -p x
Instructions how to install proxychains-ng on ubuntu are here and how to cpu miner for monero are here.

Testing if it works

To check if it works, I will assume we use the following moneropool. First lets check IP address for the pool address: mine.moneropool.com
nslookup mine.moneropool.com
Server: 127.0.1.1
Address: 127.0.1.1#53
Non-authoritative answer:
Name: mine.moneropool.com
Address: 54.75.230.12
Name: mine.moneropool.com
Address: 54.75.230.15
Name: mine.moneropool.com
Address: 54.78.196.115
Name: mine.moneropool.com
Address: 54.75.230.11
Name: mine.moneropool.com
Address: 54.78.210.153
Name: mine.moneropool.com
view raw nslookup hosted with ❤ by GitHub
Note that you may have different IP addresses, as the pool is on the Amazon cloud and the IP can be different. Having the IPs lets use iftop to monitor our outgoing connections. If you dont have iftop, install itsudo apt-get install iftop First, lets check the iftop (run using sudo iftop) window when we run the minred miner without proxychains and torsudo /opt/cpuminer-multi/minerd -a cryptonight -o stratum+tcp://mine.moneropool.com:3333 -u YOUR_WALLET_ADDRESS -p x When using the minerd without tor, we should see Amazon servers in the iftop window since the miner connects directly to the pool:
As can be seen, some of the servers were found in the nslookup for the mine.moneropool.com.


Now, lets see what happens when we use proxychains:udo proxychains4 /opt/cpuminer-multi/minerd -a cryptonight -o stratum+tcp://mine.moneropool.com:3333 -u YOUR_WALLET_ADDRESS -p x
The Amazon's servers are gone from the iftop, since the minerd connects to the Amazon servers using our tor. Instead of Amazon names, we see an input tor node.

Saturday, August 15, 2015

Install and test proxychains-ng (or proxychains4) in Ubuntu 14.04

To download, compile and set-up do the following:
# if you havent done it yet, please download the tor-browser and start it
# https://www.torproject.org/download/download-easy.html.en
wget https://www.torproject.org/dist/torbrowser/5.0/tor-browser-linux64-5.0_en-US.tar.xz
tar xf tor-browser-linux64-5.0_en-US.tar.xz
# download the source of proxychains-ng
git clone https://github.com/rofl0r/proxychains-ng.git
cd proxychains-ng
# configure and install
./configure --prefix=/usr --sysconfdir=/etc
make
sudo make install
sudo make install-config # installs /etc/proxychains.conf
# I've noticed that is better to change one default line
# in /etc/proxychains.conf to what tor browser (i.e. firefox)
# is using as can be seen here: http://i.imgur.com/pKuqHPU.jpg
sudo gedit /etc/proxychains.conf
Chanege last line in the file:
from “socks4 127.0.0.1 9050” to “socks5 127.0.0.1 9150”
# to test if proxychains4 goes through tor
# we can do two simple tests. For this we need elinks and iftop
sudo apt-get install elinks iftop


To test the proxychain
For example using iftop. Run iftop in a second terminal window: sudo iftop Now run elinks https://ipleak.net/ and check what you see in both the elinks and iftop. You should see your real IP in the ipleak test, and iftop should show that you are directly connecting to ipleak.net as shown below:


Now do the same through proxychain:proxychains4 elinks https://ipleak.net/
And we should see that iftop shows we are connection to an entry tor node, and elinks should show are tor ID, instead of real one.

Ubuntu 14.04: compile CPUMiner / minerd (forked by LucasJones & Wolf) for Monero mining

To CPU mine Monero in a moneropool it is suggested to use cpuminer called minerd. To compile it on Ubuntu 14:04 or later, the following dependencies are required:

sudo apt-get install build-essential autotools-dev autoconf libcurl3 libcurl4-gnutls-dev
# get git to install it
sudo apt-get install git
# dependencies
sudo apt-get install build-essential autotools-dev autoconf libcurl3 libcurl4-gnutls-dev
# download latest version
git clone https://github.com/wolf9466/cpuminer-multi
cd cpuminer-multi/
# compile
./autogen.sh
CFLAGS="-march=native" ./configure
make
#install
sudo make install
Example use: minerd -a cryptonight -o stratum+tcp://mine.moneropool.com:3333 -u YOUR_WALLET_ADDRESS -p x



Once you start mining using moneropool, you can check your status at anytime on their front page using your xmr address:
Just remember that their pending balance updates after a while. For me it took maybe 1-2h before I saw any pending balance after I had started mining. Hash rate updates very quickly though.


Just in case you get the errorconfigure.ac:133: error: possibly undefined macro: AC_MSG_ERROR
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.

it means that you haven't install libcurl4-gnutls-dev.

xfce4: Lunch desktop file from command line

Example: exo-open /usr/share/applications/firefox.desktop

Thursday, July 30, 2015

Ubuntu: Open images using IrfanView

#!/usr/bin/python3
#
# Put the file, for example in: /home/marcin/bin/startirfan.py
# and mark it as executable: chmod +x /home/marcin/bin/startirfan.py
#
# Make IrfanViewMine.desktop in /home/marcin/.local/share/applications that contains:
#
# [Desktop Entry]
# Encoding=UTF-8
# Name=MineIrfanView348
# Comment=IrfanView 3.48
# Exec=/home/marcin/bin/startirfan.py %u
# Terminal=false
# Type=Application
# Icon=B68D_i_view32.0
# Categories=Application;Utility;ImageEditor;
# StartupNotify=true
# MimeType=text/plain;
# NoDisplay=true
import getpass
import os
import sys
current_user = getpass.getuser();
wine_prefix = 'env WINEPREFIX="/home/{}/.wine" '.format(current_user)
wine_cmd = wine_prefix + 'wine "C:\Program Files\IrfanView\i_view32.exe" '
if len(sys.argv) == 2:
img_file = sys.argv[1]
img_file = "Z:\\" + img_file.replace('/', '\\')
wine_cmd += '"'+img_file+'"'
print(wine_cmd)
os.system(wine_cmd)
view raw startirfan.py hosted with ❤ by GitHub
To start gimp from IfranView:
#!/usr/bin/python3
#
# add this, for example, /home/marcin/bin/startgimp.py
# to IfranViews Miscellaneus Properties/Settings
#
import os
import sys
gimp_cmd = '/usr/bin/gimp-2.8 '
if len(sys.argv) == 2:
img_file = sys.argv[1]
img_file = img_file.replace('\\', '/')
img_file = img_file.replace('Z:', '')
gimp_cmd += '"'+img_file+'"'
#with open('/home/marcin/Desktop/test.txt', 'w') as f:
# f.write(img_file)
#print(gimp_cmd )
os.system(gimp_cmd )
view raw startgimp.py hosted with ❤ by GitHub

Ubuntu: irfanview start from command line example

wine "C:\Program Files\IrfanView\i_view32.exe" "Z:\mnt\e\DCIM\100D5300\DSC_7791.JPG"

Tuesday, July 21, 2015

LG 43UF770 4K TV with gtx 960 running at 4K at 60Hz and chroma 4:4:4

This is complementary info to the one in here. I have LG 43UF770T and Gigabyte GTX 960 G1 Gaming 4GB. The PC is set to 4K@60Hz and connected to the tv using HDMI 1 port. Only this port supports HDMI ULTRA HD Deep Colour in this tv. By default HDMI 1 icon is HDMI and HDMI ULTRA HD Deep Colour is off as written above. This results in chroma 4:2:0. I changed the setting as per instructions here, i.e. HDMI 1 port icon to PC and HDMI ULTRA HD Deep Colour to On. The nvidia settings are shown below.




To test the chroma for the default setup and the new one I used chroma torture test.

The results are here:

As can be seen, the top red, middle blue and bottom text is unreadable with the default tv settings on HDMI 1 port. With the new settings, everything is clear.

Tuesday, June 16, 2015

Ubuntu 14.04: compile DCMTK 3.6.1 (development snapshot)

Get latest version from: http://dicom.offis.de/download/dcmtk/snapshot/ At the time of writing this could be done to compile latest version of the dcmtk:
# The gist shows how to compile latest development snaphost of DCMTK 3.6.1
# in Ubuntu 14.04. The version of the dcmtk avaliable in ubuntu's repositiries
# is 3.6.0, which is from 2011. The gist also shows how to setup include
#and lib folders so thatwe can use them to write our own C++ programs
# using the develpment version.
# first need to install required packages
sudo apt-get install build-essential cmake libpng12-dev libtiff5-dev libxml2-dev libjpeg8-dev zlib1g-dev libwrap0-dev libssl-dev
# where to install DCMTK
export DCMTK_PREFIX=~/dcmtk361
# download latest development snapshot of the dcmtk. At the time of writing it was dcmtk-3.6.1_20150217.tar.gz
# for latest development versions please go to: http://dicom.offis.de/download/dcmtk/snapshot/
wget http://dicom.offis.de/download/dcmtk/snapshot/dcmtk-3.6.1_20150217.tar.gz
# unpack the archive
tar xzvf dcmtk-3.6.1_20150217.tar.gz
# go into the unpacked archive
cd dcmtk-3.6.1_20150217/
# run cmake to produce make file (alrenative to using ./configure --prefix=$DCMTK_PREFIX)
cmake -DCMAKE_INSTALL_PREFIX=$DCMTK_PREFIX
# compile
make all
# install into prefix folder
make install
# as a result of the above commands the follwoing folders should be created in the $DCMTK_PREFIX
# bin, etc, include, lib, share
# optional to clean the dcmtk-3.6.1_20150217 from the files created
# during compilation.
# make clean
#----- READ BELOW when using ./configure --prefix=$DCMTK_PREFIX instead of cmake ----#
# when ./configure --prefix=$DCMTK_PREFIX is used to configure the dmckt for
# compilation and installation, the execution of the "make install" for
# this development snapshot version wont produce $DCMTK_PREFIX/lib and $DCMTK_PREFIX/include
# directories with header and library files required when wanting to write C++11 that uses
# this snapshot version. Thus, we need to create them ourselfs.
if false; then
# Copy dmcktk library files that were compilied into our $DCMTK_PREFIX/lib folder
mkdir $DCMTK_PREFIX/lib
find . -name "*.a" -exec sh -c 'echo "Copying ${0}"; cp -Rp "${0}" $DCMTK_PREFIX/lib' {} \;
# Now do the same but for header files.
mkdir $DCMTK_PREFIX/include
find . -type d -name "dcmtk" -exec sh -c 'echo "Copying ${0}"; cp -Rp "${0}" $DCMTK_PREFIX/include/' {} \;
fi

ubuntu: dcmtk convert to grayscale tiff

Example:/opt/dcmtk361/bin/dcml2pnm +ot +G ../00_org/003.dcm 003.tif

Saturday, June 06, 2015

Xubuntu 15.04: lightdm autologin

To setup autologin, create the following file: /etc/lightdm/lightdm.conf

sudo vim /etc/lightdm/lightdm.conf
And add to the following lines: [SeatDefaults]
user-session=xubuntu
autologin-user=your_user_name

Ubuntu: chome browser new instance

chromium-browser --enable-udd-profiles --user-data-dir=~/chromeProf or for chromegoogle-chrome --enable-udd-profiles --user-data-dir=~/chromeProf

Wednesday, May 27, 2015

bash: rename files to numbers

find . -name '*.jpg' | gawk 'BEGIN{ a=1 }{ printf "mv \"%s\" %04d.jpg\n", $0, a++ }' | bash

Wednesday, April 01, 2015

Saturday, March 07, 2015

Fedora 21: VirtualBox additions

su -
dnf update kernel*

dnf install kernel-headers kernel-devel dkms make bzip2 perl and reboot.
Optinally (usually not needed) KERN_DIR=/usr/src/kernels/`uname -r`

Saturday, February 28, 2015

Fedora 21: to do after install

dnf install @xfce-desktop
dnf upgrade
su -c "curl https://satya164.github.io/fedy/fedy-installer -o fedy-installer && chmod +x fedy-installer && ./fedy-installer"
dnf install terminator vim mc htop git bless okular chromium-browser krusader krename kdiff3 vnc4server gimp boost-devel yumex gcc-c++ ImageMagick ImageMagick-devel ImageMagick-c++-devel python3-matplotlib python3-ipython python3-scipy kernel-devel kernel-headers dkms make bzip2 perl eqlipse-pydev python3-devel python-devel kate ufraw imagej kde-baseapps
vim etc/gdm/custom.conf

[daemon]
AutomaticLoginEnable=true
AutomaticLogin=mz2



sudo grub2-set-default "Windows Vista (loader) (on /dev/sdb1)"

Ubuntu 14.04: Install boost 1.57

sudo apt-get install build-essential g++ python-dev autotools-dev libicu-dev build-essential libbz2-dev
wget http://downloads.sourceforge.net/project/boost/boost/1.57.0/boost_1_57_0.tar.bz2
tar xvjf ./boost_1_57_0.tar.bz2
./bootstrap.sh --prefix=/opt/boost_1_57_0
sudo ./b2
sudo ./b2 install

Friday, February 27, 2015

Ubuntu 14.04: My essential packages to be installed.

sudo apt-get install vim mc terminator bless chromium-browser krusader krename kdiff3 vnc4server gimp inkscape build-essential libmagick++-dev libboost1.55-all-dev rar octave okular network-manager-pptp network-manager-vpnc network-manager-openvpn gcc-multilib apt-file htop git xtightvncviewer ufraw imagej kde-baseapps-bin libjpeg62 libjpeg62-dev libjasper-runtime libjasper-dev libopenjpeg-dev Numix theme sudo add-apt-repository ppa:numix/ppa
sudo apt-get update
sudo apt-get install numix-gtk-theme numix-icon-theme-circle
sudo apt-get install numix-wallpaper-notd

Sublime 3 sudo add-apt-repository ppa:webupd8team/sublime-text-3
sudo apt-get update
sudo apt-get install sublime-text-installer
Bash promptexport PS1="\[\e]0;\u@\h: \W\a\]${debian_chroot:+($debian_chroot)}\u@\h:\W\$ "

Friday, February 13, 2015