April 29, 2013
Painting in mint 14
No need since David did all the work ;)
April 25, 2013
Creating a binary overlay image with the gimp
I saw a cool image at the Last Ninja Archives a couple of weeks ago. I got so inspired that I had to try to do something similar. First I needed a binary text file, there is an online ASCII to binary converter. So you don't have to write one on your own.
Looking at the Last Ninja Archive kinda brought me back in time. So I decided to get a Commodore 64 font. To install the font on OSX use the font book tool. In LinuxMint (or Ubuntu) run the command:
# gksudo "nautilus"
Then, click the install font button in the top right corner of nautilus. This should add the font to all the needed places. Here is some additional help for installing fonts in linux and some for adding fonts to the gimp windows version. (I found that I also needed to reboot the window$ machine to see the font (what a surprice!! :D))
The look I'm interested in is an overlay of transparent binary numbers allowing you to see The last Ninja through the digits. Also, the image should look like it is running on an old monitor, filled with scan lines.
To create the image you'll need to know how to use layers, the color select and fill tool. Before you start take some time to tune in on slayradio and then fire up the Gimp and paint away.
The number of character rows are: image height/font size. Which adds up to 312px/10px = 31 rows.
which is characters * rows = 55 * 31 = 1705 characters.
That means you'll need to convert at least num charecters/binary encoding, which is 8bits. Thats: 1705/8 ≈ 214 characters all in all. Then you'll need a few more just to align the binary text nicely with in the image.
If you like, you can now invert the selection and cut only the zeros and ones containing the parts of the original image. This can be pastes into a new image with transparent background, to create an image that will work on other than black background. Remember black ninja's are the coolest.
Here's an image based on the original C= graphics, screenshot from vice.
Looking at the Last Ninja Archive kinda brought me back in time. So I decided to get a Commodore 64 font. To install the font on OSX use the font book tool. In LinuxMint (or Ubuntu) run the command:
# gksudo "nautilus
Then, click the install font button in the top right corner of nautilus. This should add the font to all the needed places. Here is some additional help for installing fonts in linux and some for adding fonts to the gimp windows version. (I found that I also needed to reboot the window$ machine to see the font (what a surprice!! :D))
The look I'm interested in is an overlay of transparent binary numbers allowing you to see The last Ninja through the digits. Also, the image should look like it is running on an old monitor, filled with scan lines.
To create the image you'll need to know how to use layers, the color select and fill tool. Before you start take some time to tune in on slayradio and then fire up the Gimp and paint away.
First, create the video overlay
- Open the source image.
- Press 'command' d to duplicate the image.
- Select: filters | distorts | video.
- Keep the default settings in the video dialog, perfect old scanline look.
- Press ok and see the result.
- Save the image so you dont loose it.
Second, create the binary text
- Goto ASCII2BinaryConverter.
- Paste a portion of ASCII encoded text and press convert.
- Copy the converted binary text.
The number of character rows are: image height/font size. Which adds up to 312px/10px = 31 rows.
which is characters * rows = 55 * 31 = 1705 characters.
That means you'll need to convert at least num charecters/binary encoding, which is 8bits. Thats: 1705/8 ≈ 214 characters all in all. Then you'll need a few more just to align the binary text nicely with in the image.
Third, creating the binary text
- Create a new image in the same size as the source image with white background color.
- Select the text tool and cover the whole image area.
- Choose: Commodore font size 10, un-tick anti aliasing, and paste all your binary text.
- Color select the binary text, using the color selector tool, un-tick no feather.
- Copy the selection from your binary text image.
- Paste as new layer on the white image.
Fourth, create the binary mask
- Select color the pasted text using color select. (if it is not selected after paste).
- Merge layer down.
- Invert selection.
- Select: menu item edit and fill with foreground color.
- Invert selection.
- Cut the letters to get a black drawing with transparent characters.
- Select none.
- Save the binary mask image.
Fifth, we'll add the binary mask to the scan line image
- Open the scan line image.
- Open the binary mask image.
- Color select the black part of the binary mask.
- Cut the mask.
- Paste as new layer on the scan line image.
- Save your image.
If you like, you can now invert the selection and cut only the zeros and ones containing the parts of the original image. This can be pastes into a new image with transparent background, to create an image that will work on other than black background. Remember black ninja's are the coolest.
Here's an image based on the original C= graphics, screenshot from vice.
April 22, 2013
Its a kind of Magic ... Imagemagick
Spring is here, which means its time to dust off the old website.
First you should update your Firefox browser with some small cool web design utilities: Firefox webdeveloper addons And then, you need to install imagemagick. This is the coolest image tool I have seen so far!
# sudo aptitude install imagemagick
And then you should have close look at all the cool scripts that Fred has already done on your behalf. Use Fred's Imagemagick scripts.
I have a bunch of social network sites that I'd like my main web site to link to. The construction is already at my site. But, I have no neat icons :(
I looked at the some different ones, fund the ones I (for some reason liked) and decided to do a simple glow effect to the icon. Fred's got a script just for this called glow.
Download the glow script and place it in your ~/bin folder if you don't already have a personalised bin folder for all your crazy stuff create one.
# mkdir ~/bin
Update your .bashrc to set the path, add the line: PATH=~/bin:$PATH using your favourite editor or:
# perl -p -i -e "s|^(PATH).*$|$1=~/bin:$PATH|g" ~/.bashrc
you're ready to go, test by issuing a
# glow
This should give you the glow scripts usage text. Once that is setup you can use this simple script or create your own.
add_glow (source)
#!/bin/sh
USAGE="$0 [source_dir] [dest_dir] all images from source will be substituded to <imagename>.glow.<imageextention>"
IMG_SRC_DIR=$1
IMG_DEST_DIR=$2
if [ -n "$IMG_SRC_DIR" -a -d "$IMG_SRC_DIR" ]; then
if [ -n "$IMG_SRC_DIR" -a -d "$IMG_DEST_DIR" ]; then
for IMG in $(ls $IMG_SRC_DIR); do
DEST_IMG=$(basename $IMG)
echo "prosessing $IMG"
glow -a 1.7 -s 16 $IMG $IMG_DEST_DIR/${DEST_IMG%%.png}.glow.png
done
exit 0
else
echo "No dest directory"
fi
else
echo "No source directory"
fi
echo "$USAGE"
exit 1
place that script in the ~/bin folder as well not you can create a folder for the source images and one for the destination images, and tun the add_glow script
# mkdir ~/glow_pngs
Assuming your source images are in ~/normal_pngs
# add_glow ~/normal_pngs ~/glow_pngs
Voila, now you have glow effect on all your source images.
Next off you'll have to use them on your web page. Here's a quick img tag modification that can change image when the mouse is over the image, and back when the mouse leaves the image.
<img src="icontexto-inside-xfit.png" onmouseover="this.src='icontexto-inside-xfit.glow.png'" onmouseout="this.src='icontexto-inside-xfit.png'" alt="Xfit" width="32" height="32"/>
You can check out the result @www.dideriksen.org
First you should update your Firefox browser with some small cool web design utilities: Firefox webdeveloper addons And then, you need to install imagemagick. This is the coolest image tool I have seen so far!
# sudo aptitude install imagemagick
And then you should have close look at all the cool scripts that Fred has already done on your behalf. Use Fred's Imagemagick scripts.
I have a bunch of social network sites that I'd like my main web site to link to. The construction is already at my site. But, I have no neat icons :(
I looked at the some different ones, fund the ones I (for some reason liked) and decided to do a simple glow effect to the icon. Fred's got a script just for this called glow.
Download the glow script and place it in your ~/bin folder if you don't already have a personalised bin folder for all your crazy stuff create one.
# mkdir ~/bin
Update your .bashrc to set the path, add the line: PATH=~/bin:$PATH using your favourite editor or:
# perl -p -i -e "s|^(PATH).*$|$1=~/bin:$PATH|g" ~/.bashrc
you're ready to go, test by issuing a
# glow
This should give you the glow scripts usage text. Once that is setup you can use this simple script or create your own.
add_glow (source)
#!/bin/sh
USAGE="$0 [source_dir] [dest_dir] all images from source will be substituded to <imagename>.glow.<imageextention>"
IMG_SRC_DIR=$1
IMG_DEST_DIR=$2
if [ -n "$IMG_SRC_DIR" -a -d "$IMG_SRC_DIR" ]; then
if [ -n "$IMG_SRC_DIR" -a -d "$IMG_DEST_DIR" ]; then
for IMG in $(ls $IMG_SRC_DIR); do
DEST_IMG=$(basename $IMG)
echo "prosessing $IMG"
glow -a 1.7 -s 16 $IMG $IMG_DEST_DIR/${DEST_IMG%%.png}.glow.png
done
exit 0
else
echo "No dest directory"
fi
else
echo "No source directory"
fi
echo "$USAGE"
exit 1
place that script in the ~/bin folder as well not you can create a folder for the source images and one for the destination images, and tun the add_glow script
# mkdir ~/glow_pngs
Assuming your source images are in ~/normal_pngs
# add_glow ~/normal_pngs ~/glow_pngs
Voila, now you have glow effect on all your source images.
Next off you'll have to use them on your web page. Here's a quick img tag modification that can change image when the mouse is over the image, and back when the mouse leaves the image.
<img src="icontexto-inside-xfit.png" onmouseover="this.src='icontexto-inside-xfit.glow.png'" onmouseout="this.src='icontexto-inside-xfit.png'" alt="Xfit" width="32" height="32"/>
You can check out the result @www.dideriksen.org
Counting a files
This'll be the third time I'm listing something about find. This time I'm using it to count the number of files in a directory. At work I needed to know if a specific folder would break one of our tools because it might have too many files. (Long story)
# find YOURDIR -type f ¦ wc -l
Its the wc that does the actual counting by adding up each line from find.
# find YOURDIR -type f ¦ wc -l
Its the wc that does the actual counting by adding up each line from find.
April 16, 2013
sudo echo??? Hey isn't that an 80 band?
If you ever need to echo stuff into a file, and I'll bet you do! tee's the answer. Here's a snissle:
#echo "Acquire::http::Proxy \"$http_proxy\";" | sudo tee -a /etc/apt/apt.conf.d/70debconf
Updates the aptitude settings with the proxy server from your environment. Oh and removing it afterwards is done with:
#sudo perl -p -i -e "s/^Acquire.*$//g" /etc/apt/apt.conf.d/70debconf
Have fun ;)
#echo "Acquire::http::Proxy \"$http_proxy\";" | sudo tee -a /etc/apt/apt.conf.d/70debconf
Updates the aptitude settings with the proxy server from your environment. Oh and removing it afterwards is done with:
#sudo perl -p -i -e "s/^Acquire.*$//g" /etc/apt/apt.conf.d/70debconf
Have fun ;)
April 12, 2013
C++ posix thread wrapping
Here's a short story on using posix threads and getting them into c++ objects if that's your preferred language. Tutorial link to the C version. Threads info.
The following source is my two cents on C++ posix threads. There are two files: thread.h and thread.cpp. They create an inheritable thread class that you can use to implement your specialised threads.
Now if you use the code, remember you'll have to link it against the pthread library (libpthread) do this by adding option -lpthread to your compiler (or in your Makefile| Makefile.am).
Here's some implementation details on how the thread code can be used. It's available in the incoming_connection.h & incoming_connection.cpp files. But you can't expect to build these directly as there are some files missing.
These files are just for showing the intent of the thread implementation. Have fun! And yes you should sometimes just read code, it's like reading a good book!
The following source is my two cents on C++ posix threads. There are two files: thread.h and thread.cpp. They create an inheritable thread class that you can use to implement your specialised threads.
Now if you use the code, remember you'll have to link it against the pthread library (libpthread) do this by adding option -lpthread to your compiler (or in your Makefile| Makefile.am).
Here's some implementation details on how the thread code can be used. It's available in the incoming_connection.h & incoming_connection.cpp files. But you can't expect to build these directly as there are some files missing.
These files are just for showing the intent of the thread implementation. Have fun! And yes you should sometimes just read code, it's like reading a good book!
April 05, 2013
Setting up a debian repository with reprepro
So you're rolling your own?! Let's distribute em to the masses then, you know they want them! I'm using reprepro for distribution, installing is straight forward just check the guide in the link.
The repository I have is located remotely on a server machine, where I can only ssh and scp packages to either my home, or the repository folder. This setup has some drawbacks when scripting for repository update compared to a local database.
When working using ssh and tools like this you should setup ssh_agent as it will be really really help full. So, unless you get off on typing your password to the remote machine all the time, configure ssh agent.
The repository database is present on the repository_server in the normal www directory. /var/www/repository. This is the directory you should use when setting up the repository. The repository user have only write access to the users home folder and the repository server.
repository_user@repository_server:/home/repository_user & repository_user@repository_server:/var/www/repository
The setup for including packages to the remote repository, is that the binary packages must first be uploaded to the repository server and secondly included in the repository. The upload part is done on your local machine and the inclusion in done remotely.
The first copy part is straight forward using scp
scp package repository_user@repository_server:/home/repository_user
The second part with the package inclusion must be run on the repository_server, you do this by directing the script to the ssh connection:
The following listing is the script that I use to maintain my repository
#!/bin/bash
function die {
echo $1;
echo;
exit 1;
}
package=$1;
repro_dir=$2
user=<repository_user>
host=<repository_server>
ext=deb;
backup_dir=old_packages;
home_dir=/home/$user;
test -z "$package" && test ! -f "$package" && die "No package!";
scp $package $user@$host:$home_dir;
ssh $user@$host << ENDSSH;
test ! -f $package && echo "No package!" && exit 1;
test ! -d $repro_dir && echo "No repository dir!" && exit 1;
test ! -d $backup_dir && mkdir -p $backup_dir;
find $repro_dir -name "${package%.$ext}*.$ext" -exec cp -vf {} $home_dir/$backup_dir \;
md5sum ~/$package > /dev/null;
cd $repro_dir;
reprepro includedeb mk3 ~/$package;
ENDSSH
The repository I have is located remotely on a server machine, where I can only ssh and scp packages to either my home, or the repository folder. This setup has some drawbacks when scripting for repository update compared to a local database.
When working using ssh and tools like this you should setup ssh_agent as it will be really really help full. So, unless you get off on typing your password to the remote machine all the time, configure ssh agent.
The repository database is present on the repository_server in the normal www directory. /var/www/repository. This is the directory you should use when setting up the repository. The repository user have only write access to the users home folder and the repository server.
repository_user@repository_server:/home/repository_user & repository_user@repository_server:/var/www/repository
The setup for including packages to the remote repository, is that the binary packages must first be uploaded to the repository server and secondly included in the repository. The upload part is done on your local machine and the inclusion in done remotely.
The first copy part is straight forward using scp
scp package repository_user@repository_server:/home/repository_user
The second part with the package inclusion must be run on the repository_server, you do this by directing the script to the ssh connection:
ssh repository_user@repository_server << ENDSSH
<your script>
ENDSSH
The following listing is the script that I use to maintain my repository
#!/bin/bash
function die {
echo $1;
echo;
exit 1;
}
package=$1;
repro_dir=$2
user=<repository_user>
host=<repository_server>
ext=deb;
backup_dir=old_packages;
home_dir=/home/$user;
test -z "$package" && test ! -f "$package" && die "No package!";
scp $package $user@$host:$home_dir;
ssh $user@$host << ENDSSH;
test ! -f $package && echo "No package!" && exit 1;
test ! -d $repro_dir && echo "No repository dir!" && exit 1;
test ! -d $backup_dir && mkdir -p $backup_dir;
find $repro_dir -name "${package%.$ext}*.$ext" -exec cp -vf {} $home_dir/$backup_dir \;
md5sum ~/$package > /dev/null;
cd $repro_dir;
reprepro includedeb mk3 ~/$package;
ENDSSH
Labels:
debian repository,
reprepro,
ssh-agent
April 04, 2013
Company proxy configuration
If you're running your Linux box @work you most likely have the issue of using the company proxy server. I know I do :'O With the current Ubuntu / Linuxmint there's still a couple of places you'll need to configure before you have your proxy settings up and running.
The worst part is when you have to update your windows password. Cause you'll have to update all the configuration files on your box to be able to connect to the proxy with your new password. And a password change happens quite often these days. Here's a small note on the strategy: proxy to get your theory on the same page.
I installed cntml, a small local proxy tool that can handle the proxy connection stuff for you windows servers. cntml worked better for me, that's the only reason for not running ntml!
#sudo aptitude install cntml
Then, you'll have to configure the buggar, cntml have a great guide for this, so follow that one, and then you'll have to setup you browser and command line utilities and most likely your apt-conf as well.
As an system update can be run through pkexec and gksudo, which is what you do when you update using the GUI tools for updating. You'll have to setup the proxy server for the apt tool. This is because at writing pkexec and gksudo does not carry the cmd line proxy settings, which will cause both of these tools to fail the update.
First, You'll have to add a file to your apt.conf.d with the proxy, I just created a file called 98proxy in the /etc/apt/apt.conf.d/ directory, containing the cntlm proxy settings.
# echo 'Acquire::http::Proxy "http://localhost:3128";' | sudo tee /etc/apt/apt.conf.d/98proxy > /dev/null
Or edit the file by using you favorite editor.
Second, you'll have to setup your command line proxy, either locally via ~/.bashrc or as I did for the machine with a proxy.sh script in the /etc/profile.d/ dir You can copy the following to either you ~/.bashrc file or create a proxy script file. i.e.
# sudo touch /etc/profile.d/proxy
# sudo nano /etc/profile.d/proxy
Then copy and paste this:
#!/bin/bash
export http_proxy="http://localhost:3128"
export http_proxy="https://localhost:3128"
export http_proxy="ftp://localhost:3128"
export no_proxy="localhost,<your domain>"
You'll also have to edit the sudoers file to get your environment kept, you you ever need to run stuff as root!
# sudo nano /etc/sudoers
Paste the following to keep your settings (The Display is not for the proxy but you might like to haveroot windows displayed on your gui aswell)
Defaults env_keep = "DISPLAY"
Defaults env_keep += "proxy"
Defaults env_keep += "http_proxy"
Defaults env_keep += "https_proxy"
Defaults env_keep += "ftp_proxy"
Defaults env_keep += "no_proxy"
Third, you'll need to use the proxy in all you browser, spotify etc. Remember to set the no_proxy stuff aswell, as you may have internal domain look up issues. Change firefoxes settings via the gui, edit|preferences.
I rolled a small company-proxy-settings package containing the changes I mention here, just use it, on your own account. The package has an additional script that you may want. It is called cntml_config and you can run it every time you'll have to change your company password!
Script listing:
# sudo touch /usr/bin/cntlm_config
# sudo nano /usr/bin/cntlm_config
Paste the contents:
#!/bin/bash
config=/etc/cntlm.conf
domain=<your domain>
sudo service cntlm stop
echo -n "Enter your username for windows: ";
read user;
unset pass;
prompt="Enter password for windows: "
while IFS= read -p "$prompt" -r -s -n 1 char
do
if [[ $char == $'\0' ]]
then
break
fi
prompt='*'
pass+="$char"
done
echo "";
sudo perl -p -i -e "s|(Username\t).*$|Username\t$user|g" $config;
sudo perl -p -i -e "s|(Password\t).*$|Password\t$pass|g" $config;
sudo perl -p -i -e "s|(Domain\t).*$|Domain\t\t$domain|g" $config;
sudo perl -p -i -e "s/10.0.0.41:8080/<your proxy>/g" $config;
sudo perl -p -i -e "s/Proxy.*10[.]0[.]0[.]42:8080//g" $config;
sudo chmod 0600 $config;
sudo service cntlm start
replace the <your domain> and <your proxy> in the script with your company settings and you should be good to go. Modify and use at your own risk!
The worst part is when you have to update your windows password. Cause you'll have to update all the configuration files on your box to be able to connect to the proxy with your new password. And a password change happens quite often these days. Here's a small note on the strategy: proxy to get your theory on the same page.
I installed cntml, a small local proxy tool that can handle the proxy connection stuff for you windows servers. cntml worked better for me, that's the only reason for not running ntml!
#sudo aptitude install cntml
Then, you'll have to configure the buggar, cntml have a great guide for this, so follow that one, and then you'll have to setup you browser and command line utilities and most likely your apt-conf as well.
As an system update can be run through pkexec and gksudo, which is what you do when you update using the GUI tools for updating. You'll have to setup the proxy server for the apt tool. This is because at writing pkexec and gksudo does not carry the cmd line proxy settings, which will cause both of these tools to fail the update.
First, You'll have to add a file to your apt.conf.d with the proxy, I just created a file called 98proxy in the /etc/apt/apt.conf.d/ directory, containing the cntlm proxy settings.
# echo 'Acquire::http::Proxy "http://localhost:3128";' | sudo tee /etc/apt/apt.conf.d/98proxy > /dev/null
Or edit the file by using you favorite editor.
Second, you'll have to setup your command line proxy, either locally via ~/.bashrc or as I did for the machine with a proxy.sh script in the /etc/profile.d/ dir You can copy the following to either you ~/.bashrc file or create a proxy script file. i.e.
# sudo touch /etc/profile.d/proxy
# sudo nano /etc/profile.d/proxy
Then copy and paste this:
#!/bin/bash
export http_proxy="http://localhost:3128"
export http_proxy="https://localhost:3128"
export http_proxy="ftp://localhost:3128"
export no_proxy="localhost,<your domain>"
You'll also have to edit the sudoers file to get your environment kept, you you ever need to run stuff as root!
# sudo nano /etc/sudoers
Paste the following to keep your settings (The Display is not for the proxy but you might like to haveroot windows displayed on your gui aswell)
Defaults env_keep = "DISPLAY"
Defaults env_keep += "proxy"
Defaults env_keep += "http_proxy"
Defaults env_keep += "https_proxy"
Defaults env_keep += "ftp_proxy"
Defaults env_keep += "no_proxy"
Third, you'll need to use the proxy in all you browser, spotify etc. Remember to set the no_proxy stuff aswell, as you may have internal domain look up issues. Change firefoxes settings via the gui, edit|preferences.
I rolled a small company-proxy-settings package containing the changes I mention here, just use it, on your own account. The package has an additional script that you may want. It is called cntml_config and you can run it every time you'll have to change your company password!
Script listing:
# sudo touch /usr/bin/cntlm_config
# sudo nano /usr/bin/cntlm_config
Paste the contents:
#!/bin/bash
config=/etc/cntlm.conf
domain=<your domain>
sudo service cntlm stop
echo -n "Enter your username for windows: ";
read user;
unset pass;
prompt="Enter password for windows: "
while IFS= read -p "$prompt" -r -s -n 1 char
do
if [[ $char == $'\0' ]]
then
break
fi
prompt='*'
pass+="$char"
done
echo "";
sudo perl -p -i -e "s|(Username\t).*$|Username\t$user|g" $config;
sudo perl -p -i -e "s|(Password\t).*$|Password\t$pass|g" $config;
sudo perl -p -i -e "s|(Domain\t).*$|Domain\t\t$domain|g" $config;
sudo perl -p -i -e "s/10.0.0.41:8080/<your proxy>/g" $config;
sudo perl -p -i -e "s/Proxy.*10[.]0[.]0[.]42:8080//g" $config;
sudo chmod 0600 $config;
sudo service cntlm start
replace the <your domain> and <your proxy> in the script with your company settings and you should be good to go. Modify and use at your own risk!
Labels:
cntml,
linuxmint proxy configuration,
windows proxy
March 26, 2013
Remote connections
You know the drill! You need to fix a thing at work, a 5 minute thing, but you box was never setup to handle remote connections properly. So fix it, you know you'll need it in two shakes of a lambs tale!
There's a couple of possibilities, VNC (slower than smoking death!) ssh, and some that run on the remote desktop protocol like XRDP.
# sudo aptitude install openssh-server
Then you'll have to allow your remote machine to connect to your box:
# sudo emacs /etc/ssh/sshd_config
Remove the # comment sign from: ForwardX11 no. Then change no to yes so it looks like this:
ForwardX11 yes
Save and exit. Next you'll have to add you remote machine name to the xhost by:
#xhost +<your ip or machine.domain>
Next you'll have to check that the .Xauthority file in your home folder is owned by your user (mine wasent?)
# ls -l ~/.Xauthority
-rw------- 1 user user 181 Mar 25 13:35 .Xauthority
If not you should chown it ro your user:
# sudo chown user ~/.Xauthority
You'll now be able to remote connect to your box from any machine with a running x server. Simply start the XServer on your client machine, login via ssh and run the program. In putty you'll have to forward X11 packages, there's a setting called just that.
# sudo aptitude install tightvncserver
or
# sudo aptitude install x11vnc
The difference is that tightvncserver will serve a new session. x11vnc will allow access to an existing session. That may be what you'll need if you have a running session on your work box. If you use x11vnc you might want to set a password.
#sudo aptitude install xrdp
You connect to it by using the Windows remote desktop connection utility. You'll get a new screen, so this utility can't steal your current x session.
There's a couple of possibilities, VNC (slower than smoking death!) ssh, and some that run on the remote desktop protocol like XRDP.
Putty & XMing
If you're a Winer, you'll need putty for ssh'ing and a X server, i use XMing. And you'll need to prepare your box if you run Linuxmint Desktop edition.# sudo aptitude install openssh-server
Then you'll have to allow your remote machine to connect to your box:
# sudo emacs /etc/ssh/sshd_config
Remove the # comment sign from: ForwardX11 no. Then change no to yes so it looks like this:
ForwardX11 yes
Save and exit. Next you'll have to add you remote machine name to the xhost by:
#xhost +<your ip or machine.domain>
Next you'll have to check that the .Xauthority file in your home folder is owned by your user (mine wasent?)
# ls -l ~/.Xauthority
-rw------- 1 user user 181 Mar 25 13:35 .Xauthority
If not you should chown it ro your user:
# sudo chown user ~/.Xauthority
You'll now be able to remote connect to your box from any machine with a running x server. Simply start the XServer on your client machine, login via ssh and run the program. In putty you'll have to forward X11 packages, there's a setting called just that.
VNC
To use VNC you'll have to install a VNC server on your box, i.e or X11vnc# sudo aptitude install tightvncserver
or
# sudo aptitude install x11vnc
The difference is that tightvncserver will serve a new session. x11vnc will allow access to an existing session. That may be what you'll need if you have a running session on your work box. If you use x11vnc you might want to set a password.
XRDP
Install XRDP and run the deamon.#sudo aptitude install xrdp
You connect to it by using the Windows remote desktop connection utility. You'll get a new screen, so this utility can't steal your current x session.
Labels:
Linux,
Putty,
Remote desktop,
XMing,
XRDP
March 21, 2013
Listing aptitude sources
Forgot your repositories? Here's how to list em:
# find /etc/apt -name '*.list' -exec bash -c 'echo -e "\n$1\n"; cat -n "$1"' _ '{}' \;
I <3 find !
# find /etc/apt -name '*.list' -exec bash -c 'echo -e "\n$1\n"; cat -n "$1"' _ '{}' \;
I <3 find !
March 15, 2013
If mint update fails
It could be an issue with wlan. I have experienced some issues this this setup through a proxy server..
Try quitting mintupdate and issue:
Try quitting mintupdate and issue:
#sudo ifconfig wlan0 down #sudo apt-get updateStart mintupdate again that should solve the problem.
Spotify
Running on Mint13 out of the box! Follow: https://www.spotify.com/dk/download/previews/
March 04, 2013
Emacs & case
I know it's basic knowledge for all ya emacsers. Nevertheless, I'm always amused when I re-find something I totally forgot! Like today, when I had to convert a buncha constants to uppercase in some action script code. As always emacs have the answer to your problems: Emacs & Casing
Thats M-u & M-l ok?
Thats M-u & M-l ok?
Labels:
editor,
emacs,
lowercase,
programming,
uppercase
February 25, 2013
Renaming files
Lately I tried to order a bunch of my old photos. All imported from CD, with similar names (guess it was from back when the digicams started over once they'd lost their battery?).
Any huh I needed to rename some photos when there was a name clash, and I didn't bother pointing and clicking in this case. Here's a small command line renamer:
for i in *.jpg ; do mv $i new_name${i#01} ; done
Have fun!
Any huh I needed to rename some photos when there was a name clash, and I didn't bother pointing and clicking in this case. Here's a small command line renamer:
for i in *.jpg ; do mv $i new_name${i#01} ; done
Have fun!
February 18, 2013
UnitTest++
Writing unit tests for your C++ code is sometimes painful. But fear no more, with UnitTest++ and it's fixture feature, your shared data between the individual tests becomes so easy to set up it's almost cheating! Sweet!
The code in the tweet is for the svn version of the unittest++ framework, not the one available in google code!!
Just dump the files in your test directory and use them like this:
#include <fstream>
#include <unittest++/UnitTest++.h>
#include <unittest++/TestRunner.h>
#include <test_reporter_junit.h>
using namespace std;
using namespace UnitTest;
int main()
{
ofstream f("test-report.xml");
Test_reporter_junit reporter(f);
TestRunner runner(reporter);
return runner.RunTestsIf(Test::GetTestList(),NULL,True(),0);
}
jUnit test reporter available for unittest++ 1.4 - docs.google.com/folder/d/0B_6N…
— SmukkeCharlie (@SmukkeCharlie) February 25, 2013
The code in the tweet is for the svn version of the unittest++ framework, not the one available in google code!!
Just dump the files in your test directory and use them like this:
#include <fstream>
#include <unittest++/UnitTest++.h>
#include <unittest++/TestRunner.h>
#include <test_reporter_junit.h>
using namespace std;
using namespace UnitTest;
int main()
{
ofstream f("test-report.xml");
Test_reporter_junit reporter(f);
TestRunner runner(reporter);
return runner.RunTestsIf(Test::GetTestList(),NULL,True(),0);
}
Labels:
C++,
jUnit,
unittest++,
XmlReporter
November 23, 2012
November 14, 2012
Resetting your windows password
You lost it he's getting it back for ya'll: passwd
October 09, 2012
Insight debugger
Insight debugger remember to add the repository key:
#sudo apt-key adv --keyserver=keyserver.ubuntu.com --recv-keys 35DA01C261E46227
#sudo apt-key adv --keyserver=keyserver.ubuntu.com --recv-keys 35DA01C261E46227
September 29, 2012
Nvidia on Linux mint 13
I own a Lenovo thinkpad W520 (well work owns it but I'm using it) it runs Linux mint 13 - mate with the latest generic-pae kernel. At writing (3.2.0-31). At work when my machine is docked I need support for multiple monitors, and for this I need the Nvidia drivers. Here's the recipe that worked for me.
reboot your machine hold the blue ThinkVantage key and go into the bios menu.
Once you're booted into the mate desktop and logged in, enable the xorg edgers ppa
There's a recipe in the link. Then, do a
# sudo aptitude install nvidia-current nvidia-setting
I rebooted, and had nvidia graphics for dual monitors, but there's no intel graphics saving when I'm undocked!
I tried a buncha stuff from various blogs and forums, but nothing worked for me except disabling the optimus setting in the bios. The nvidia module was inserted but not activated. There's a number of ways to look at your gfx loading to help you locate the error.
Checking if glx is running:
# glxinfo
Looking at info from the Xserver startup:
# egrep '\((EE|WW|NI)\)' /var/log/Xorg.0.log
Checking that the glx module is loaded:
# egrep -i 'glx|nvidia' /var/log/Xorg.0.log
Check the references for details: Nvidia-304.51 X-swat Changing driver dual gfx cards Xorg-wiki
reboot your machine hold the blue ThinkVantage key and go into the bios menu.
- Choose the nvidia graphis card. It's called discrete graphics in the display bios display menu item.
- Then disable the optimus os detection setting.
- save & exit
Once you're booted into the mate desktop and logged in, enable the xorg edgers ppa
There's a recipe in the link. Then, do a
# sudo aptitude install nvidia-current nvidia-setting
I rebooted, and had nvidia graphics for dual monitors, but there's no intel graphics saving when I'm undocked!
I tried a buncha stuff from various blogs and forums, but nothing worked for me except disabling the optimus setting in the bios. The nvidia module was inserted but not activated. There's a number of ways to look at your gfx loading to help you locate the error.
Checking if glx is running:
# glxinfo
Looking at info from the Xserver startup:
# egrep '\((EE|WW|NI)\)' /var/log/Xorg.0.log
Checking that the glx module is loaded:
# egrep -i 'glx|nvidia' /var/log/Xorg.0.log
Check the references for details: Nvidia-304.51 X-swat Changing driver dual gfx cards Xorg-wiki
Labels:
Linuxmint 13,
mate,
nvidia,
optimus
September 20, 2012
VPN connection from Linuxmint 13
The default Mint 13 installation doesn't include the Cisco AnyConnection compatible client. This means that you'll need to install the network-manager-openconnect plug-in in your network manager.
#sudo aptitude install network-manager-openconnect
Once its done, restart the networkmanager with:
#sudo service network-manager restart
You'll now be able to select open connect from the networkm-anagers vnp menu. If the networkmanager is not shown in the panel you can run it with
#nm-applet &
Then click the network connection icon oon your panel, and select VPN connections > configure VPN
In the network connections window select the +add button, and select Cisco AnyConnect Compatible VPN option.
Fill in your credentials and server name/ip in the edit VPN connection window, and name your connection to what ever you'd like. When you're done save it.
To use your new VPC connection, click the network icon on your panel, and select vpn connections and select your freshly baked connection.
In the connect window, click the hostname/ip address and then click the connection button. Wait .... and fill in your user/passwd when you're asked to.
You'll see a small lock on-top of your network icon once your connection is established.
#sudo aptitude install network-manager-openconnect
Once its done, restart the networkmanager with:
#sudo service network-manager restart
You'll now be able to select open connect from the networkm-anagers vnp menu. If the networkmanager is not shown in the panel you can run it with
#nm-applet &
Then click the network connection icon oon your panel, and select VPN connections > configure VPN
In the network connections window select the +add button, and select Cisco AnyConnect Compatible VPN option.
Fill in your credentials and server name/ip in the edit VPN connection window, and name your connection to what ever you'd like. When you're done save it.
To use your new VPC connection, click the network icon on your panel, and select vpn connections and select your freshly baked connection.
In the connect window, click the hostname/ip address and then click the connection button. Wait .... and fill in your user/passwd when you're asked to.
You'll see a small lock on-top of your network icon once your connection is established.
Subscribe to:
Posts (Atom)