Skip to content

Instantly share code, notes, and snippets.

@simos
simos / mytest.py
Created February 21, 2012 14:10
Python hello world
print "Αυτή είναι μια δοκιμή"
@simos
simos / gist:1876740
Created February 21, 2012 14:11 — forked from defunkt/gist:2059
def explain!
puts 'Want to embed this Gist?'
puts 'Use this: <script src="http://gist.github.com/2059.js"></script>'
end
/* This is a second test /*
@simos
simos / gist:1876756
Created February 21, 2012 14:16 — forked from defunkt/gist:2059
def explain!
puts 'Want to embed this Gist?'
puts 'Use this: <script src="http://gist.github.com/2059.js"></script>'
end
explain!
@simos
simos / language.txt
Created March 20, 2012 12:41
i18n/language.txt
# Default language for installer images built with this defaults package.
# Note that the defaults package itself does not configure the locale, this
# only gets effective for image builds.
#
# Format: single line with language code (or ll_CC for the languages like zh
# which have two major codes like zh_CN or zh_TW). See /isolinux/langlist on a
# Ubuntu live CD for the complete list.
#
# Example:
# de
@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.
@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 / 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")
#!/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'):
#!/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
@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