Skip to content

Instantly share code, notes, and snippets.

@simos
simos / kodi-headless-ubuntu1604.sh
Created March 14, 2018 19:02
Script to compile Kodi with --headless option on Ubuntu 16.04 (in a LXD container)
#!/bin/sh
# Converted from https://github.com/linuxserver/docker-kodi-headless/blob/master/Dockerfile
#FROM lsiobase/xenial
#
## set version label
#ARG BUILD_DATE
#ARG VERSION
#LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
@simos
simos / snapcraft.yaml
Created February 20, 2017 17:04
Snapcraft.yaml for howdoi
name: howdoi # you probably want to 'snapcraft register <name>'
version: '20170207' # just for humans, typically '1.2+git' or '1.3.2'
summary: instant coding answers via the command line # 79 char long summary
description: |
Are you a hack programmer? Do you find yourself constantly Googling
for how to do basic programing tasks?
Suppose you want to know how to format a date in bash. Why open your browser
and read through blogs (risking major distraction) when you can simply
stay in the console and ask howdoi.
@simos
simos / snapcraft.yaml
Last active February 9, 2017 19:04
snapcraft.yaml for httpstat
name: httpstat # you probably want to 'snapcraft register <name>'
version: '1.1.3' # just for humans, typically '1.2+git' or '1.3.2'
summary: Curl statistics made simple # 79 char long summary
description: |
httpstat is a utility that analyses show fast a website is
when you try to connect to it.
This utility is particularly useful to Web administrators.
grade: stable # must be 'stable' to release into candidate/stable channels
confinement: strict # use 'strict' once you have the right plugs and slots
@simos
simos / snapcraft.yaml
Last active February 6, 2017 15:10
how2 snapcraft.yaml
name: how2 # you probably want to 'snapcraft register <name>'
version: '20170206' # just for humans, typically '1.2+git' or '1.3.2'
summary: how2, stackoverflow from the terminal
description: |
how2 finds the simplest way to do something in a unix shell.
It is like the man command, but you can query it in natural language.
grade: stable # must be 'stable' to release into candidate/stable channels
confinement: strict # use 'strict' once you have the right plugs and slots
@simos
simos / snapcraft.yaml
Last active February 6, 2017 12:37
snapcraft.yaml for httpstat
name: httpstat # you probably want to 'snapcraft register <name>'
version: '1.1.3' # just for humans, typically '1.2+git' or '1.3.2'
summary: Curl statistics made simple # 79 char long summary
description: |
httpstat is a utility that analyses show fast is a website
when you are trying to connect to it.
This utility is particularly useful to Web administrators
grade: stable # must be 'stable' to release into candidate/stable channels
confinement: strict # use 'strict' once you have the right plugs and slots
#!/bin/bash
touch /tmp/Recent.xyz
while true
do
echo "Checking again..."
wget -q https://apt.dockerproject.org/repo/dists/ubuntu-xenial/main/binary-amd64/Release -O /tmp/Release.xyz
if test /tmp/Release.xyz -nt Recent.xyz; then
mplayer /usr/share/sounds/ubuntu/stereo/phone-incoming-call.ogg
#!/usr/bin/env python
FILENAME="Lesvos Birdings map of birding sites-Steve Dudley.gpx"
from lxml import etree
tree = etree.parse(FILENAME)
root = tree.getroot()
for wpt in tree.xpath('//wpt'):
@simos
simos / align-git.py
Created October 24, 2014 11:31
Align a tarball to a commit in a git repository
#!/usr/bin/env python
import os
import subprocess
# We want to reach back to a commit where the following file is identical in the tarball.
FILENAME="page_alloc.c"
# We created this file with: git log | grep '^commit' | awk '{ print $2}' > /tmp/commit-list.txt
commit_file = open("/tmp/commit-list.txt", "r")
@simos
simos / killppid.c
Created November 18, 2013 21:37
Sample that kills the parent process. If you run from within a terminal, the program will terminate the calling shell (thus terminating the terminal window).
#include <signal.h> /* For SIGKILL */
int main()
{
/* Sends the SIGKILL signal to the Parent Process ID (ppid) */
kill(getppid(), SIGKILL);
return 0;
}
@simos
simos / parse_weather.py
Created November 12, 2013 10:55
Parses a parameterlist.htm file and creates a dictionary(hash table) with the data.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# We open the file and create the handle 'f' to access the content.
f = open("parameterlist.htm", 'r')
# The variable 'lines' now has all the lines of the file. 'lines' is an array.
lines = f.readlines()
# We initialise a hash table (dictionary) that we will put the parsed parameters in.