Category Archives: bash

#hubicfuse with #debian for busy people

Install the debian package:

apt-get install hubicfuse

Clone the project:

git clone git@github.com:TurboGit/hubicfuse.git

You will need to use one of the scripts from this project.
Or just the script hubic_token from
here.

Create an app on hubic.
Get the client_id and client_secret.

Create a file named .hubicfuse on your ~/
execute the script hubic_token
copy the token form the script

the .hubicfuse file should look like this:

client_id=api_hubic_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
client_secret=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
refresh_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
verify_ssl=false

I used ssl = False to avoid issues with my auto-signed certificate.

Add your user to fuse group if you haven’t (look here).

create a mount point:

mkdir hubic

then mount:

sudo hubicfuse ~/hubic -o noauto_cache,sync_read

to umount,
fusermount -u hubic

Enjoy!

get IPs only from arp -a with #vim

arp -a

? (192.168.1.111) at 50:b7:c3:xx:xx:xx [ether] on eth0
? (192.168.1.1) at c8:d7:19:xx:xx:xx [ether] on eth0
? (192.168.1.116) at  on eth0
? (192.168.1.106) at 70:9e:29:xx:xx:xx [ether] on eth0
? (192.168.1.28) at 9c:b6:54:xx:xx:xx [ether] on eth0
? (192.168.1.119) at 70:9e:29:xx:xx:xx [ether] on eth0
? (192.168.1.101) at 50:b7:c3:xx:xx:xx [ether] on eth0
? (192.168.1.4) at b8:27:eb:xx:xx:xx [ether] on eth0
? (192.168.1.105) at 20:e5:2a:xx:xx:xx [ether] on eth0
? (192.168.1.31) at  on eth0
? (192.168.1.26) at 20:4e:7f:xx:xx:xx [ether] on eth0
? (192.168.1.104) at 34:36:3b:xx:xx:xx [ether] on eth0
? (192.168.1.103) at 00:90:f5:xx:xx:xx [ether] on eth0
? (192.168.1.108) at e4:e0:c5:xx:xx:xx [ether] on eth0
? (192.168.1.107) at 6c:ad:f8:xx:xx:xx [ether] on eth0
? (192.168.1.112) at b0:79:94:xx:xx:xx [ether] on eth0
? (192.168.1.102) at 6c:ad:f8:xx:xx:xx [ether] on eth0

with vim:
:%s/.*(\(.*\)).*/\1/g

192.168.1.111
192.168.1.1
192.168.1.116
192.168.1.106
192.168.1.28
192.168.1.119
192.168.1.101
192.168.1.4
192.168.1.105
192.168.1.31
192.168.1.26
192.168.1.104
192.168.1.103
192.168.1.108
192.168.1.107
192.168.1.112
192.168.1.102

install new #crontab from #bash script

you need to:

  1. save the current cron jobs for the user
  2. create a file with the new job description (pun intended)
  3. insert the new configuration
  4. check the new conf

1.
crontab -l > /tmp/current_cron
or, even better. append directly to your cron conf
crontab -l >> cronconf.txt

2.
the file should look like
cat cronconf.txt
*/1 * * * * /bin/ls >> /tmp/ls
*/1 * * * * /bin/touch /tmp/me

3.
Insert the new conf by calling crontab
crontab cronconf.txt

4.
check the new conf with
crontab -l

homogenization of hours and minutes with awk


~$ awk -F ' ' '{if($3=="hours") {print $2*60, "min" } else {print $2,$3}}' /tmp/sample.data
120 min
20 min
0
20 min
120 min
25 min
5 min
10 min
25 min
45 min
10 min
95 min
80 min
20 min
0
20 min

sample file

data  2 hours
data  20 min
data  0
data  20 min
data  2 hours
data  25 min
data  5 min
data  10 min
data  25 min
data  45 min
data  10 min
data  95 min
data  80 min
data  20 min
data  0
data  20 min

flowblade, mirage and other python-gtk2 applications crashing in debian

version
-------
flowblade    = 1:0.12.0-dmo1
mirage       = 0.9.5.1-3
python-gtk2  = 2.24.0-4 
debian       = jessie/sid 

how to reproduce
----------------
launch on the CLI
mirage or flowblade

you will get:
-------------
"""Attempt to unlock mutex that was not locked
Aborted"""


ugly fix:
---------

search:
"gtk.gdk.threads_init"
(example vim /usr/lib/python2.7/dist-packages/mirage.py, line 74)

replace by:
gtk.gdk.threads_init()
gtk.gdk.threads_enter()


source:
-------
https://bugs.mageia.org/show_bug.cgi?id=13776