Skip to content

Instantly share code, notes, and snippets.

View edufelipe's full-sized avatar

Eduardo Felipe edufelipe

View GitHub Profile
@edufelipe
edufelipe / single-consumer-1.json
Last active August 24, 2021 18:18
SignageQ Samples
{
"queues": [
{
"id": "82a5819f-84fe-4755-8dc2-c6f439ef454e",
"t": "single-consumer",
"name": "Priority Queue 1",
"prefix": "P-",
"bg_color": "#B0BF1A",
"fg_color": "#000000",
"attr_name": "__attr-7jgG%$'s",
@edufelipe
edufelipe / tzregex.py
Created December 5, 2014 01:12
Generate a Regular Expression containing all common timezones from pytz
from collections import OrderedDict
def make_tree(strings):
"""Take a list of strings and returns a dict tree with chars as keys.
>>> make_tree(['cat', 'car', 'dog'])
{'c': {'a': {'r': {}, 't': {}}}, 'd': {'o': {'g': {}}}}
"""
root = branch = OrderedDict()
@edufelipe
edufelipe / is_wireless.c
Created July 29, 2013 21:33
C example code to list all network interfaces and check whether they are wireless or not. Linux only. Tested on Ubuntu 10.04 and 12.04, but should be compatible with pretty much everything out there.
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <ifaddrs.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <linux/wireless.h>
@edufelipe
edufelipe / sendmail.py
Last active December 11, 2015 20:58 — forked from xfenix/gist:3206768
"""sendmail django email backend class."""
import threading
from django.conf import settings
from django.core.mail.backends.base import BaseEmailBackend
from subprocess import Popen,PIPE
class EmailBackend(BaseEmailBackend):
def __init__(self, fail_silently=False, **kwargs):
@edufelipe
edufelipe / swipey.css
Created October 25, 2012 12:51
A Javascript image gallery with hardware transitions.
body {
margin: 0;
padding: 0;
background: #000;
color: #fff;
text-align: center;
font-family: Helvetica;
}
#wrapper {
@edufelipe
edufelipe / fb_image.c
Created August 14, 2012 17:58
Write the PID on a semi-transparent DirectFB Window.
#include <directfb.h>
#include <stdio.h>
#include <unistd.h>
#define DFBCHECK(x...) \
do { \
DFBResult err = x; \
if (err != DFB_OK) { \
printf("%s <%i>:", __FILE__, __LINE__); \
@edufelipe
edufelipe / lsmount.py
Created January 16, 2012 17:23
Pretty Print mount's output.
#!/usr/bin/env python
# Copyright (c) 2012 Eduardo Felipe Castegnaro, http://github.com/edufelipe/
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
@edufelipe
edufelipe / prettyjson.py
Created July 13, 2010 18:43
Script to prettyprint and highlight json to terminal
#!/usr/bin/env python
import cStringIO
import json
import sys
from pygments import highlight
from pygments.formatters import TerminalFormatter
from pygments.lexers.web import JavascriptLexer