Skip to content

Instantly share code, notes, and snippets.

View zouppen's full-sized avatar

Joel Lehtonen OH64K zouppen

View GitHub Profile
@zouppen
zouppen / README.md
Last active January 7, 2024 20:24
Tool for extracting compression ratio and amount of compressed memory from zram swap partitions.

zraminfo

This is a simple tool for displaying memory information including compression ratio and percentage of compressed memory in Linux kernel using zram. This tool works without zram, but in that case it displays only basic memory statistics.

With LC_NUMERIC=en_GB.utf8 the output of ./zraminfo looks like this:

@zouppen
zouppen / README.md
Last active December 27, 2015 20:19
Konstruktorin tiimit

Konstruktori

Tässä gistissä on jokainen idea ja vähän kuvausta siitä kukin omassa dokumentissaan

@zouppen
zouppen / flv-audio.sh
Created December 28, 2013 20:28
Extracts MPEG audio from Flash Video files
#!/bin/sh -eu
#
# Unwraps Flash Video container and removes video (if any) from given file and outputs .mp4 file which may be
# played back with almost any device you own. No re-encoding is performed so the quality stays the same as in
# original.
#
# Suggested use with yle-dl, Youtube downloader, etc.
ffmpeg -i "$1" -vn -acodec copy "`basename "$1" .flv`.mp4"
@zouppen
zouppen / apt-unique
Last active January 4, 2016 15:19
Shows manually installed packages on Debian-like operating system, like Ubuntu
#!/bin/sh -eu
# Shows manually installed packages on Debian / Ubuntu system
#
# Author: Joel Lehtonen <[email protected]>
# Public domain. If you found this useful, please donate to
# 1FvEggFtNSYS9pcBoYB9wDxH9fa1mrNPW5
MANIFEST=
usage() {
cat <<EOF
@zouppen
zouppen / README.md
Last active August 29, 2015 13:59
Kiitos Linkki 2006-2014
@zouppen
zouppen / mietteet.md
Last active August 29, 2015 14:00
Stokastisin menetelmin hankittu mietetietokanta.
for X in `seq 100`; do curl 'http://jyvasmetro.fi/opinions/random' -H 'Accept: application/json' -H 'X-Requested-With: XMLHttpRequest'; done | runhaskell magic.hs
  • Anen ripuliblogi
  • Bar Ihanaan taas tsemppikakalle
  • DAIM-OHJE RUUTUUN!!!!
  • Eebin eebin tästä lähtee eebin!
  • Eeppistä settiä pitkin Jykylää Suomen parhaimmassa metrossa!
  • Fuksit seuraa vierestä, kun dynaamiset substanssiosaajat juo konua Neden kanssa.
@zouppen
zouppen / gray_binary_clock.c
Last active August 29, 2015 14:01
Gray coded binary clock in C
#include <sys/timerfd.h>
#include <err.h>
#include <time.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h> /* Definition of uint64_t */
#define GUARD(x) { if ((x)==-1) err(1,"Unable to initialize clock"); }
@zouppen
zouppen / console_tick_clock.c
Created May 15, 2014 08:44
Console tick clock
/**
* Console tick clock by Joel Lehtonen, joel.lehtonen ät iki.fi
* Public Domain
*
* Clock which outputs a character every second. The time displayed
* matches the wall clock at every newline.
*
* This may experience leap second issue. Not tested with that. Also,
* sorry about the magic numbers. This is just a funny console clock,
* not a proof of work :-)
@zouppen
zouppen / EveningPlan.hs
Last active August 29, 2015 14:01
Evening planning helper
-- |Evening planning simulation. It compiles, therefore it works.
module EveningPlan where
data Coffee = Coffee | Tea | Beer deriving Show
isItFriday = True
eveningPlan :: Maybe Coffee
eveningPlan = if isItFriday
then Just Beer
@zouppen
zouppen / joel-seconds.sh
Created November 13, 2014 14:33
Joel 10⁹ ticker
#!/bin/sh -eu
BORN=`date +%s -d '1983-03-07 18:32'`
LEAPSECS=14
while sleep 1; do
echo `date +%s` - $BORN + $LEAPSECS | bc
done