Linux

Sound volume issues when using kivy on Debian with gnome and pulse audio fixed

When using kivy on a Debian system running pulse audio (gnome) you would encounter issues with the sound volume due to the fact that kivy would set the volume to 100% each time it uses the soundcard.
The problem is in pulse audio, what’s new πŸ™ as it’s the from the same author who brings us systemd.
You can remove pulse audio as much of gnome depends on it.
You can however disable pulse and use good old alsa.

Disable pulse in /etc/pulse/client.conf uncomment the line “”autospawn = yes”” and set it to “”autospawn = no””
Install gnome alsa mixer, sudo apt-get install gnome-alsamixer
Restart alsa, sudo alsa force-reload
Or use alsamixer (console) to control the volumes.

Tried to use key shortcuts in gnome but that doesn’t work correctly.
Just use trusted xbindkeysrc always works πŸ™‚

install xbindkeys, sudo apt-get install xbindkeys
Use this .xbindkeysrc file and your done (after logout and login)

#Alsa Volume Down
""amixer set Master 3- unmute""
   XF86AudioLowerVolume

#Alsa Volume Up
 ""amixer set Master 3%+ unmute""
 XF86AudioRaiseVolume

#Alsa mute/unmute toggel
 ""amixer sset Master toggle""
 XF86AudioMute

Flash TWRP on Samsung Tab2 10.1 using linux

Flashing TWRP on Samsung Tab2 10.1 using linux can brick your device
and I’m not responsible for any issues you might face.

As Samsung doesn’t have a “”fastboot”” mode but only “”download”” mode
you need Heimdall/Odin to flash TWRP onto the device.
As many members of my family have samsung tab2 tablet which are not getting
any updates from Samsung anymore they are getting slower and slower with
any app that’s updated.
As the tablets are in pefect working order and the problem is software related
it’s much better and cheaper to just replace the samsung OS with LineageOS to
gave them a second live πŸ™‚

Put device into download mode (odin mode)
Power button and volume up (is the right side of the button)
Then push volume down (left side) and make sure the device says “”Downloading…””

Now connect device by USB to your linux machine.

On your Linux machine:
sudo apt-get install heimdall
sudo heimdall detect
sudo heimdall print-pit --no-reboot

(Device might reboot without –no-reboot)
Go into download mode again

In the output of the ‘print-pit’ look for
“”Partition Name: RECOVERY””

Use that as your partition name, sometimes it could be in small caps, then
use small caps.

sudo heimdall flash --RECOVERY twrp-3.1.0-0-p5110.img --no-reboot

Disconnect USB cable

Now reboot into recovery by using keep pressed the buttons power + volume down (left side)
your device will reboot after 10 seconds and as soon as you see the samsung name on the screen
release the power button.

You are now in TWRP recovery and “”swipe to allow modifications”” to sideload a custom rom like LineageOS.

Manually resize a SD card for your Raspberry Pi (version2)

Warning, use these instructions on your own risk.

 

When I tried to resize the 16GB SD card in the raspberry pi version 2 I got a corrupted file system and all other kinds
of nastiness.

So I decided to try to resize the thing manually.

First “”dd”” the image to the SD card.

Leave the card in the reader/writer and issue the following comands, replace the device for you own device
and use the units for your card.

 

$ sudo parted /dev/sdd
 GNU Parted 2.3
 Using /dev/sdd
 Welcome to GNU Parted! Type 'help' to view a list of commands.

 (parted) print
 Model: Generic- SD/MMC (scsi)
 Disk /dev/sdd: 16,1GB
 Sector size (logical/physical): 512B/512B
 Partition Table: msdos
Number Start End Size Type File system Flags
 1 4194kB 62,9MB 58,7MB primary fat16 lba
 2 62,9MB 3277MB 3214MB primary ext4

(parted) unit chs
 (parted) print
 Model: Generic- SD/MMC (scsi)
 Disk /dev/sdd: 1955,244,16
 Sector size (logical/physical): 512B/512B
 BIOS cylinder,head,sector geometry: 1955,255,63. Each cylinder is 8225kB.
 Partition Table: msdos
Number Start End Type File system Flags
 1 0,130,2 7,165,29 primary fat16 lba
 2 7,165,30 398,97,18 primary ext4

(parted) rm 2
 (parted) mkpart primary 7,165,30 1955,244,16
 (parted) quit

 Information: You may need to update /etc/fstab.

$ sudo e2fsck -f /dev/sdd2
 e2fsck 1.42.9 (4-Feb-2014)
 Pass 1: Checking inodes, blocks, and sizes
 Pass 2: Checking directory structure
 Pass 3: Checking directory connectivity
 Pass 4: Checking reference counts
 Pass 5: Checking group summary information
 /dev/sdd2: 86233/196224 files (0.1% non-contiguous), 630146/784640 blocks

 $ sudo resize2fs /dev/sdd2
 resize2fs 1.42.9 (4-Feb-2014)
 Resizing the filesystem on /dev/sdd2 to 3912448 (4k) blocks.
 The filesystem on /dev/sdd2 is now 3912448 blocks long.

$ sudo parted /dev/sdd
 GNU Parted 2.3
 Using /dev/sdd
 Welcome to GNU Parted! Type 'help' to view a list of commands.
 (parted) print
 Model: Generic- SD/MMC (scsi)
 Disk /dev/sdd: 16,1GB
 Sector size (logical/physical): 512B/512B
 Partition Table: msdos
Number Start End Size Type File system Flags
 1 4194kB 62,9MB 58,7MB primary fat16 lba
 2 62,9MB 16,1GB 16,0GB primary ext4
(parted) quit
 $

 

And of course, don’t choose ‘resize’ when the rspi first boots πŸ™‚

Rotate video 90 degrees clockwise

I’ve have a video shot with a phone and for some reason the maker thought it would be a good idea to keep the phone upright while filming.
So now I’m forced to view the video with my head turned 90 degrees.
It’s uncomfortable so lets turn this video 90 degrees clockwise.

avconv -i inputvideo.mp4 -c:a copy -q 1 -r 23.967 -vf ""transpose=1"" outputvideo.mp4

dpkg –set-selections results in “warning: package not in database….”

(original posted: 2013)

When you want to restore your packages that you’ve backup-ed with :

sudo dpkg --get_selections > selections.txt

And when you restore them with:

dpkg --set-selections < selections.txt

And the result is a whole bunch of warnings likeΒ  “”warning: package blabla not in database….””

Then theres a easy fix:

$ sudo apt-get install dselect
$ sudo dselect
   -> Update
   -> Install

Done.

 

Install Ubuntu Linux on a samsung series 5 ultrabook with SSD

(original posted: 2012)

To install Ubuntu Linux on your samsung series 5 ultrabook with SSD you should change some stuff in your BIOS as well as change some things in your Ubuntu Linux install.
I used Ubuntu 12.10 as that’s the most current version at this moment.

You must first disable ‘secure boot’ as it’s a Microsoft thing we don’t need it and would make things a lot more complicated.
Start the laptop and keep pressing the F2 button.
Your now in the BIOS setup.

‘Advanced’ -> ‘Fast Biosmode’ > Disabled
‘Security’ -> ‘Secure boot configuration’ > Customized signatures
‘Boot’ -> Move USB HDD to the top
-> ‘Secure Boot’ > Disabled
-> ‘OS mode selection’ > CSM OS
‘Exit’ > Save and exit

That’s it, no more secure boot crap.

Connect your usb-stick.
Boot the laptop.

When installing Ubuntu remove all the partitions on sda (HDD) and sdb (SSD).
Make one new partition on sdb (SSD) with mount point ‘/’ (root)
Make on sda (HD) the following (extended) partitons:
(Size is a personal issue but you get the idea)
sda5 swap 6GB
sda6 /var 20GB
sda7 /home remaining space

Install Ubuntu.

When the install is finished no want to set some mount options in to keep the write actions to the SSD to a minimum.
Open you /etc/fstab file and make sure you have the following mount options for your SSD:
noatime,nodiratime,discard,errors=remount-ro
So your fstab line for SSD would look something like this:
(This is actually one line in fstab)
UUID=c1526b35-193f-4573-9817-b0fa06100b93 / ext4 noatime,nodiratime,discard,errors=remount-ro 0 1
(Of course your UUID would be different.)

You should also move the /tmp directory to a ramdisk so that the directory would no longer be on SSD but lives in RAM.
Again it’s something you do in fstab:
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0

You could also set a different scheduler for the SSD to get the most out of it.
Edit /etc/rc.local and add the following line ABOVE the line ‘exit 0’.
echo deadline >/sys/block/sda/queue/scheduler

Your done, reboot and enjoy your 3 seconds boot time :-)”

Keep your ssh session alive

(original posted: 2012)

To keep your ssh session alive thus preventing to being locked out when the firewall is reloaded or whatever add a ‘config’ file to you local .ssh directory.

$ cat .ssh/config
Host *
ServerAliveInterval 60

Now your session is will be kept alive.”

git ssh Agent admitted failure to sign using the key

hen you get a “”Agent admitted failure to sign using the key”” when trying to git pull or push you can add your key to ssh.

ssh-add ~/.ssh/id_rsa

 

Encode url from bash

(original posted: 2012)

IF you need to encode parts of a POST url:
SUM=$(md5sum $APPNAME.tar.gz.gpg 1> /dev/null)
SUMENC=$(echo $SUM’ /*$$[]’ | perl -MURI::Escape -lne ‘print uri_escape($_)’)”

 

kv language designing with anchorlayout

0

(original posted: 2012)
When designing a Kivy menu with the kv language I run into troubles with the anchorlayout object.
It seems that you need to put every object inside a achorlayout which itself is part of a anchorlayout.

Sounds a bit vague so an example should do:

AnchorLayout:
    id: topmenu
    anchor_x: 'center'
    anchor_y: 'top'

    BoxLayout:
        orientation: 'horizontal'
        AnchorLayout:
        anchor_x: 'left'
        anchor_y: 'top'
        padding: 8
        Button:
             id: infobutton
             size: (48, 48)
             size_hint: None, None
             background_normal: 'info_button.png'
             background_down: 'info_button.png'
             on_press: root.on_button_clicked(&quot;info&quot;)

       AnchorLayout:
           anchor_x: 'center'
           anchor_y: 'top'
           padding: 8
       BoxLayout:
           padding: 0
           spacing: 4
           size: (300, 48)
           size_hint: None, None
           orientation: 'horizontal'
           AnchorLayout:
                anchor_x: 'center'
                anchor_y: 'top'
                Button:
                     size: (48, 48)
                     size_hint: None, None
                     background_normal: 'star1.png'
                     on_press: root.on_button_clicked(&quot;star1&quot;)
          AnchorLayout:
               anchor_x: 'center'
               anchor_y: 'top'
               Button:
                   size: (48, 48)
                   size_hint: None, None
                   background_normal: 'star1.png'
                   on_press: root.on_button_clicked(&quot;star2&quot;)
          AnchorLayout:
               anchor_x: 'right'
               anchor_y: 'top'
               padding: 8
               Button:
                    id: quitbutton
                    size: (48, 48)
                    size_hint: None, None
                    background_normal: 'quit_button.png'
                    background_down: 'quit_button_ro.png'
                    on_press: root.on_quit_button_clicked()


Go to Top