Tuesday, June 14, 2016

Fixing dropbox 100% CPU starting Ubuntu 2016

Uninstalled and reinstalled dropbox using followed instructions here:

https://www.dropbox.com/en/help/246

Specifically:

Add the following line to /etc/apt/sources.list.d/dropbox.list
(Replace trusty with your build's name below.)

deb http://linux.dropbox.com/ubuntu trusty main 
 
To import our GPG keys into your apt repository, perform the following command from your terminal shell:

$ sudo apt-key adv --keyserver pgp.mit.edu --recv-keys 1C61A2656FB57B7E4DE0F4C1FC918B335044912E


"Removed" user installed dropboxd using followed instructions here:

mv ~/.dropbox-dist ~/.dropbox-dist_old

Ask dropbox to reinstall the dropboxd in the userspace

dropbox start -i


Now things are working!

Saturday, December 15, 2012

QEMU User-Mode ARM for Raspbian chroot

The other day I forgot my password for my raspberrypi running raspbian. If this were a amd64 system, I would chroot the system and use passwd to reset my password, but the raspberrypi is an arm system, and the passwd binary of the guest system cannot be executed on my amd64 host system. Enter QEMU user-mode emulation.

Following loosely these intructions here:

http://wiki.debian.org/QemuUserEmulation


  This is what I did: Install qemu, binfmt-support, and qemu-user:
# apt-get install qemu binfmt-support qemu-user
The step involving dpkg-cross I did slightly differently, as I noticed the necessary packages were available in synaptic for Ubuntu 12.04. This is what I installed
# sudo apt-get install libc6-armel-cross libc6-dev-armel-cross
"Point QEMU to the target linux loader For example, for the arm(el) architecture." Add this line to the /etc/qemu-binfmt.conf:
EXTRA_OPTS="-L /usr/arm-linux-gnueabi"
This is needed for chroot user-mode (no dynamic loading is possible because paths would be frubbed):
# sudo apt-get install qemu-user-static
Then I removed the raspbian sdcard from the raspberrypi, and mounted it using my laptop sdcard reader @ /media/disk. It is necessary to copy this file to the /usr/bin of the tree to be chrooted:
# cp /usr/bin/qemu-arm-static /media/disk/usr/bin
Then
# chroot /media/disk
I was able to reset my password successfully, and I notice I can also use the chroot to build (e.g. xbmc) for arm using my laptop, which, even if its user-mode emulated arm, should still be faster per core, and I can build multi-core. That was easier than I thought it would be!

Monday, March 26, 2012

Install XBMC PPA on Ubuntu

The XBMC version 11.0 is released and available from the team-xbmc PPA for Ubuntu (tested for Ubuntu 11.10)

sudo add-apt-repository ppa:team-xbmc/ppa
sudo apt-get update
sudo apt-get install xbmc

After install, here's how I got my environment set up:

  • Setup -> Skin -> Subtitles Addon -> Install XBMC Subtitles Addon

Tuesday, February 14, 2012

Kubuntu OpenConnect VPN (AnyConnect) with GNOME nm-applet

The network manager in Kubuntu 11.10 still does not support OpenConnect

Basically I followed this BLOG post.

But with slight variation for Kubuntu 11.10

I used synaptic to simultaneously uninstall  plasma-widget-networkmanager
and install "network-manager-gnome openconnect network-manager-openconnect network-manager-openconnect-gnome" packages.

Then added nm-applet to Autostart as follows:

$ grep -v NotShowIn /etc/xdg/autostart/nm-applet.desktop > ~/.config/autostart/nm-applet.desktop

K->search-> "Autostart" ... enable "nm-applet"

Wireless was strangely not connecting after selecting a SSID.  It turns out one also needs to install the "gnome-keyring" package ...

Wednesday, November 30, 2011

Webbrowser privacy notes

AdBlock plus -> can be built from source

Current version I'm using:
hg up -r 1.3.10
http://adblockplus.org/en/source

Lists:

General settings:

  • Flash block
  • Disable password saving

Tuesday, September 13, 2011

find & grep

Find all files which have the name "BlueConfig" and contain "AllCompartments"

find . -name BlueConfig -exec grep -Hn AllCompartments {} \;

Sunday, August 14, 2011

Firewall testing for Linux

Evaluated two GUI to nmap: Zenmap and Knmap.

Nmap ("Network Mapper") is a utility for network exploration or security auditing. It supports ping scanning (determine which hosts are up), many port scanning techniques, version detection, and TCP/IP fingerprinting.

Zenmap (this was my favourite)

Zenmap is an Nmap frontend. It is meant to be useful for advanced users and to make Nmap easy to use by beginners. It was originally derived from Umit, an Nmap GUI created as part of the Google Summer of Code.

Install:

$ sudo apt-get install zenmap

Knmap

Knmap is a KDE-based interface to the 'nmap' facility available at http://www.insecure.org/nmap.

The main Knmap window provides for the entry of nmap options and the display of nmap-generated output.

$ sudo apt-get install knmap


Saturday, March 19, 2011

GIMP Color-to-Alpha

From: http://gimpbook.com/tips.html
Eliminate a solid background behind text or a simple figure:
For instance, if you have a solid white background with antialiased text on it,
and you want to keep the text but change the background to transparent:
The Color to Alpha plug-in (in the Colors menu) will usually do a nice job, much better than Select by Color. If you need to touch up small areas, try drawing with the Paintbrush tool, with the foreground color set to the background color you want to erase and the tool's Mode set to Color Erase. (Make sure you've enabled alpha on the layer.)

This tool is under the "Color" menu -> Color to Alpha

Thursday, March 10, 2011

svn: Can't move '.svn/tmp/entries' to '.svn/entries': Operation not permitted sshfs

Are you getting this error message on svn checkout with sshfs?

svn: Can't move '.svn/tmp/entries' to '.svn/entries': Operation not permitted sshfs

# Add the -o workaround=rename option fixes the problem

sshfs -o workaround=rename user@server:/dir ~/mnt/dir


See:

http://stackoverflow.com/questions/3016368/after-mounting-using-sshfs-i-cannot-commit-my-changes-using-subversion

Wednesday, January 26, 2011

Add new user on Ubuntu/Linux command line

useradd -m -s /bin/bash userName
passwd userName

Wednesday, October 20, 2010

LaTeX and git

Hi,

Some of you may remember our discussion at dinner about using git/SVN with LaTeX documents. One of the problems that was mentioned was line-based diff - whenever the formatting of the paragraph changes all of the lines are marked as modified, even if the content did not change.

* git diff --color-words

I found very nice solution to the problem: in git diff you can use the option --color-words which performs word-based diff and highlights the changes in colors.

* gitattributes

You can also put the following line into your .gitattributes file:

*.tex diff=tex

which treats some tags (likes \section{}) as separate words even if there is no whitespace in between.

I am almost converted to git - thanks for opening my eyes ;)

Cheers,

Bartek

Wednesday, October 6, 2010

PyAS - nuggets

PyAS - Nuggets

Ipython cpaste magic func to paste in code.

cython -a -> annotated html with colours for how long things take ... click to expand

Tuesday, October 5, 2010

Git & github getting started

Global setup:

Download and install Git
git config --global user.name "Your Name"
git config --global user.email eilif@gmx.de


Next steps:

mkdir test
cd test
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin git@github.com:markovg/test.git
git push origin master


Existing Git Repo?

cd existing_git_repo
git remote add origin git@github.com:markovg/test.git
git push origin master


Importing a Subversion Repo?

Click here


When you're done:

Continue

Friday, October 1, 2010

Emacs tricks: cua-mode

cua-mode:

You cut some code from a website and it has a few columns of junk at the front, enter cua-mode

M-x cua-mode

Set marker, C-RET enters column mode. Select the block, C-x to cut.

Saturday, September 11, 2010

python crypt authenticate htpasswd/htdigest

A python snippet to authenticate against a htpasswd hash in Python:
from crypt import crypt
pw = '2600'
htpasswd = 'Jywn1PBEdYjkg'
authd = crypt(pw,htpasswd)==htpasswd
assert authd
authd = crypt('wrongpw',htpasswd)==htpasswd
assert authd==False

Friday, September 10, 2010

freenx and GLX

How to get freenx working with GLX & OpenGL?

me@computer:~$ glxgears
Error: couldn't get an RGB, Double-buffered visual

Try this:
$ export LIBGL_ALWAYS_INDIRECT=1

Then things should be just peachy!

Monday, September 6, 2010

distutils/setuptools python setup.py install -> automatic .deb generation

I used the python-stdeb in the ubuntu 10.04 repo to install itself using the
newest version from the git repo:

http://github.com/astraw/stdeb.git

Steps:

1) Add the following to ~/.pydistutils.cfg:

vvvvvvvvvvvvvvvv
[global]
command-packages: stdeb.command
^^^^^^^^^^^^^^

2) If necessary, edit a stdeb.cfg file which contains the options for debian/control.
The stdeb git repo already has a sensible stdeb.cfg file, but for another project,
the following might be appropriate:

[DEFAULT]
Depends: python-numpy
XS-Python-Version: >= 2.6
Provides: python-myproject


3) python setup.py bdist_deb

4) dpkg -i deb_dist/python-stdeb_0.6.0+git-1_all.deb

NB: comparing that .deb
with the one in the
apt cache:
/var/cache/apt/archives/python-stdeb_0.5.1-1_all.deb

Shows similar install paths ... so I think everythings ok

NB:
Another possibility would be:
$ sudo checkinstall --install=no python setup.py install

But I suppose stdeb is more savvy in its pythonic ways ...

Thursday, August 19, 2010

anonymous emailing for mailing lists that expose email addresses

#!/usr/bin/python

import smtplib
SERVER = "your.smtp.server"

FROM = "joe@example.com"
TO = ["mailinglist@exposes.emails.com"] # must be a list


SUBJECT = "my question to the gurus"
TEXT = """

How do I send a message to the mailing list without exposing my email address to 
spambots?

cheers,

j.


----
To hide my email address from spam-bots, this message was sent with a false sender address using Python's smtplib.

"""

# Prepare actual message

message = """\
From: %s
To: %s
Subject: %s

%s
""" % (FROM, ", ".join(TO), SUBJECT, TEXT)

# Send the mail

server = smtplib.SMTP(SERVER)
server.sendmail(FROM, TO, message)
server.quit()


Wednesday, June 30, 2010

self_taught_programmers_need_these_things.txt

Design Patterns: common "Template" solutions to regularly encountered problems/variations-on-that problem. Be careful when learning these that you don't fall victim to "when you have a hammer, everything is a nail". Also learn the Anti-patterns, wikipedia has a good list of anti-patterns.

Algorithms & Data Structures: Analysis, average running time Big O is most important, but understanding worst-case runtime is important too. Designing algorithms vs knowing when to leverage an existing one.

the C++ standard library provides a great many of these, it has a high efficiency sort (from ), it has good collection data structures (vectors, linked lists, maps, etc)

Objected Oriented Analysis And Design: Knowing when to make something an object, when and how to use inheritance and polymorphism, when to not make something an object. Plain old data objects. separation of responsibility: UI is not logic, logic is not UI.

Threading: proper thread synchronization techniques (mutexs, semaphores, conditions, etc), threading patterns such as Producer-Consumer, Inter-process communication

Automata & Computability: (Deterministic|Nondeterministic) Finite State Machines, Regular Languages, Turing Machines

Programming Languages: LL language parsing & rules authoring.

Computer Architecture: Processor design, pipelining, caching, function calling conventions, etc - how to use this knowledge to write more efficient programs

DMG on Linux

Mounting Mac OSX dmg files on Linux

#sudo apt-get install dmg2img
# this outputs myfile.img
dmg2img myfile.dmg

#modprobe hfsplus
sudo mount -t hfsplus -o loop myfile.img $MOUNTDIR