Skip to content

Instantly share code, notes, and snippets.

Avatar
🐢
Slowly advancing on hobby projects

Michel Albert exhuma

🐢
Slowly advancing on hobby projects
View GitHub Profile
@exhuma
exhuma / idioms.rst
Last active Aug 29, 2015
Useful Python Idioms/caveats you might find useful if coming from another language.
@exhuma
exhuma / README.rst
Last active Aug 29, 2015
Closure RTE as part of a larger Component.
View README.rst

README

This example shows the use of a richtext-editor component as part of another, larger component.

The Problem

While the component shows up properly, the rendered IFRAME does not take up the full width of the editor. A wild guess is that the IFRAME is rendered before the width is available.

@exhuma
exhuma / tester.py
Created Sep 12, 2014
Cluster Tester
View tester.py
from __future__ import print_function
from difflib import SequenceMatcher
def mean(numbers):
"""
Returns the arithmetic mean of a numeric list.
see: http://mail.python.org/pipermail/python-list/2004-December/294990.html
"""
return float(sum(numbers)) / float(len(numbers))
@exhuma
exhuma / Main.java
Created May 15, 2015
"Flowing" RecyclerView
View Main.java
public class LostMobile extends Activity {
// [... snip ...]
mMainRecycler = (RecyclerView) findViewById(R.id.mainList);
mMainRecycler.setHasFixedSize(true);
mMainRecycler.setLayoutManager(new LinearLayoutManager(this));
mMainListAdapter = new MyAdapter(this, remoteMap);
// [... snip ...]
mMainRecycler.setAdapter(mMainListAdapter);
@exhuma
exhuma / purgeFiles.js
Created Jun 8, 2011
Windows script to remove old files
View purgeFiles.js
/**
* Remove all files and folders that are older than a set number of days.
*
* @param rootURI The URI of the root folder. All old files and folders in this
* folder are removed.
* @param days Files older than this number of days are deleted
*/
function purgeFiles(rootURI, days) {
var fso = new ActiveXObject("Scripting.FileSystemObject");
@exhuma
exhuma / inspectJobs.js
Created Jun 9, 2011
Query Windows Scheduled Tasks and do something with it
View inspectJobs.js
/**
* Naive CSV splitter
*
* This splitter is *very* simplistic and may result in errors when parsing
* unknown CSV sources. This works well in the current problem domain.
*
* As we have well defined data, with no escaped quotes inside the fields, we
* can sefaly assume that this will work.
*/
function simpleCsvSplit(lineText){
@exhuma
exhuma / gist:1079972
Created Jul 13, 2011
Linking (un)loading of your SSH private keys with your screensaver state
View gist:1079972
import dbus.mainloop.glib
import gobject
from subprocess import Popen
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
def screensaver_state_changed(new_state):
@exhuma
exhuma / about.md
Created Aug 10, 2011 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
View about.md
@exhuma
exhuma / README.md
Created Sep 15, 2011
Personalized Web scripts for PostgreSQL Docs
View README.md

Description

These files represent the different parts for the customisation for the PostgreSQL docs.

All to make the page a bit more readable

@exhuma
exhuma / gist:1682975
Created Jan 26, 2012
python config resolver
View gist:1682975
from ConfigParser import SafeConfigParser
from os import getenv, pathsep, getcwd
from os.path import expanduser, exists, join
import logging
LOG = logging.getLogger(__name__)
CONF = None
def config(group, app, search_path=None, conf_name=None, force_reload=False):
"""