Skip to content

Instantly share code, notes, and snippets.

Avatar
🚂

Manolis Stamatogiannakis m000

🚂
  • VU University Amsterdam
View GitHub Profile
@m000
m000 / laverna_export.py
Created Apr 29, 2020
Export all your Laverna notes as markdown
View laverna_export.py
#!/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'
View cronitor-run.sh
#!/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 Nov 3, 2015
patch to enable compilation of llvm-3.3 using gcc-4.9
View llvm-3.3_gcc-4.9.diff
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 Oct 1, 2015
Case-insensitive drop-in replacement for python's dict
View CaseInsensitiveDict.py
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):
View keybase.md

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 Feb 26, 2014
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.
View strace-printaddr-a7c6e5143.diff
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
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.
View gist:5592074
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 Oct 30, 2012
Customizations for wymeditor to be used with django-cms.
View wymeditor.py
# 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 Feb 9, 2012
imagestore customizations
View models.py
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')