Skip to content

Instantly share code, notes, and snippets.

View ZubairLK's full-sized avatar

Zubair Lutfullah Kakakhel ZubairLK

View GitHub Profile
@ZubairLK
ZubairLK / os-masterclass.md
Last active October 24, 2019 09:02
os-masterclass

balenaOS Masterclass

Prerequisite Classes

This is the first balenaOS masterclass.

There are no prerequisites apart from basic linux knowledge and terminal access to a device running balenaOS.

Masterclass Type: Core Maximum Expected Time To Complete: 60 minutes

@ZubairLK
ZubairLK / chrony_sync_lost
Created November 19, 2018 18:27
caught chrony loosing time sync
root@5689936:~# chronyc sources -v
210 Number of sources = 4
.-- Source mode '^' = server, '=' = peer, '#' = local clock.
/ .- Source state '*' = current synced, '+' = combined , '-' = not combined,
| / '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
|| .- xxxx [ yyyy ] +/- zzzz
|| Reachability register (octal) -. | xxxx = adjusted offset,
|| Log2(Polling interval) --. | | yyyy = measured offset,
|| \ | | zzzz = estimated error.
@ZubairLK
ZubairLK / rachel-pi_readonly.md
Last active September 25, 2016 14:26
Making RACHEL-Pi read-only
@ZubairLK
ZubairLK / docker_reminder.txt
Last active May 15, 2016 09:38
docker reminder
Ideally, go through https://docs.docker.com/engine/userguide/intro/
Its pretty good and steps through many various features.
Ubuntu repositories usually have an old version.
Install latest from https://docs.docker.com/engine/installation/linux/ubuntulinux/
To make it easy to run docker without sudo. Add current user to sudo.
https://docs.docker.com/engine/installation/linux/ubuntulinux/#create-a-docker-group
Run hello-world container.
@ZubairLK
ZubairLK / bash_sabaq_pk.txt
Last active December 16, 2015 07:13
Extacting subject titles from sabaq.pk site map
# sabaq.pk has a site-map page which has links to all videos.
# Extracting titles of all videos using the following bash for example punjab biology 9th class
# need a few variables
subject=punjab-biology-9th
board="punjab board"
# grep subject, then video. then replace bad characters in the line with nothing using sed to generate right urls of each video
cat sabaq.xml | grep $subject | grep video | sed s/vsg/sid/ | sed 's/amp;//' | sed 's/<loc>//' | sed 's/<\/loc>//' > $subject.txt
@ZubairLK
ZubairLK / sabaq.pk_downloader.txt
Created December 6, 2015 07:39
Downloading all of sabaq.pk lectures
sabaq.pk has lectures in urdu for high school.
They are hosted on daily motion.
The easiest way would be to download them all using youtube-dl and the sabaq user.
However they are not sorted as playlists, and the video titles are not numbered.
And daily motion has an issue. It only shows 1800 videos on a 100 user pages.
Any more video pages get redirected to the 100th page.
@ZubairLK
ZubairLK / youtube-playlist.txt
Created December 6, 2015 07:30
Downloading all playlists of a user using youtube-dl khanacademy
youtube-dl is a nifty utility that can parse and download all user videos. Recently added a feature on downloading all playlists.
Here is a command that downloads all playlists of user KhanAcademyUrdu and puts all videos of each playlist in separate folders.
youtube-dl -ciw -f '(webm)[height<480]' -o '/media/zubairlk/part1/khanurdu/%(playlist)s/%(playlist_index)s_%(title)s_%(id)s.%(ext)s' --yes-playlist -R 10000 https://www.youtube.com/user/KhanAcademyUrdu/playlists
some explanation for later. see https://github.com/rg3/youtube-dl for full details.
-i is to ignore interrupts. timeouts/private videos etc block otherwise.
@ZubairLK
ZubairLK / hello.c
Created October 22, 2014 09:31
Testing gist functionality in github
this is me typing in the main window