Skip to content

Instantly share code, notes, and snippets.

View m000's full-sized avatar
☄️

Manolis Stamatogiannakis m000

☄️
  • VU University Amsterdam
View GitHub Profile
@m000
m000 / openwrt-list-installed.sh
Created July 28, 2023 17:49
OpenWRT installed package list creator
#!/bin/sh
# Outputs a list of openwrt installed packages, in the same format as the one
# used by sysupgrade to create /etc/backup/installed_packages.txt.
# This can be useful to diff the currently installed packages with the packages
# installed during a upgrade.
#
# Based-off of sysupgrade code:
# https://github.com/openwrt/openwrt/blob/master/package/base-files/files/sbin/sysupgrade
find_extra='(
( -exec test -f /rom/{} ; -exec echo {} rom ; )
@m000
m000 / laverna_export.py
Created April 29, 2020 11:05
Export all your Laverna notes as markdown
#!/usr/bin/env python3
from pathlib import Path
import json
import os
if __name__ == '__main__':
root = Path('.')
notes = (root / 'notes').glob('*.json')
export = root / 'export'
@m000
m000 / cronitor-run.sh
Created March 29, 2019 15:50
QNAP scripts
#!/bin/bash
#####################################################################
# Monitoring script for use with QNAP boxes and cronitor.io.
#####################################################################
DATA_DIR="/share/MD0_DATA"
RUN_DIR="/share/MD0_DATA/homes/admin/run"
uptime_save="$RUN_DIR"/uptime_cronitor
monitorid="QbBI8O"
cronitor_run_url="https://cronitor.link/$monitorid/run"
@m000
m000 / llvm-3.3_gcc-4.9.diff
Last active November 3, 2015 16:34
patch to enable compilation of llvm-3.3 using gcc-4.9
Index: cfe/trunk/lib/Headers/stddef.h
===================================================================
--- cfe/trunk/lib/Headers/stddef.h (revision 201728)
+++ cfe/trunk/lib/Headers/stddef.h (revision 201729)
@@ -1,102 +1,112 @@
/*===---- stddef.h - Basic type definitions --------------------------------===
*
* Copyright (c) 2008 Eli Friedman
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
@m000
m000 / CaseInsensitiveDict.py
Created October 1, 2015 13:45
Case-insensitive drop-in replacement for python's dict
class CaseInsensitiveDict(dict):
@classmethod
def _k(cls, key):
return key.lower() if isinstance(key, basestring) else key
def __init__(self, *args, **kwargs):
super(CaseInsensitiveDict, self).__init__(*args, **kwargs)
self._convert_keys()
def __getitem__(self, key):
@m000
m000 / keybase.md
Last active October 21, 2016 14:01

Keybase proof

I hereby claim:

  • I am m000 on github.
  • I am mstamat (https://keybase.io/mstamat) on keybase.
  • I have a public key ASC2PZ_e5BqDHZbdtF6k_OITFHtLz1oCs0xiPuj2_Hgmvwo

To claim this, I am signing this object:

@m000
m000 / strace-printaddr-a7c6e5143.diff
Created February 26, 2014 23:23
This patch makes strace print the address of string buffers in addition to their contents. This could be helpful when using strace to debug how data are copied in a program.
diff --git a/util.c b/util.c
index 85bb94c..9158c64 100644
--- a/util.c
+++ b/util.c
@@ -602,6 +602,7 @@ printpath(struct tcb *tcp, long addr)
printpathn(tcp, addr, MAXPATHLEN);
}
+#define PTR_ADDRESS_BUFSIZE 12
/*
@m000
m000 / gist:5592074
Created May 16, 2013 14:22
Fix for bootstrap submenus on android devices. Clicking to open the submenu, would actually close the whole menu. This one line fix worked for me (forked from https://github.com/twitter/bootstrap/commit/37d0a30589e8bd74299b2d857c348d91396563ed). Dropdowns on iOS seem to work without needing any fix.
diff --git a/js/bootstrap-dropdown.js b/js/bootstrap-dropdown.js
index a1d5151..3a59467 100644
--- a/js/bootstrap-dropdown.js
+++ b/js/bootstrap-dropdown.js
@@ -49,7 +49,7 @@
isActive = $parent.hasClass('open')
- clearMenus()
+ if (! $parent.hasClass('dropdown-submenu')) clearMenus()
@m000
m000 / wymeditor.py
Created October 30, 2012 10:38
Customizations for wymeditor to be used with django-cms.
# django-cms settings for the WYMEditor.
# See: http://docs.django-cms.org/en/latest/getting_started/configuration.html#editor-configuration
#
# We like WYMEditor because it is semantics-oriented and produces
# nice xhtml code which can then be uniformely formatted using css.
#
# Another option is TinyMCE. It requires the django-tinymce app and
# the CMS_USE_TINYMCE setting.
# We avoid TinyMCE because by default gives more formatting options
# than we think it should. This way semantic-editing is broken and
@m000
m000 / models.py
Created February 9, 2012 13:39
imagestore customizations
from imagestore.models.bases.image import BaseImage
from django.utils.translation import ugettext_lazy as _
from django.db import models
class ImageLicenceInfo(models.Model):
author_name = models.CharField(_('Author Name'), max_length=100)
# more fields to be added later...
class Meta:
verbose_name = _('Image Licence Information')