Skip to content

Instantly share code, notes, and snippets.

View Sunno's full-sized avatar
🏠
Working from home

Alvaro Marquina Sunno

🏠
Working from home
View GitHub Profile
@Sunno
Sunno / AndroidManifest.xml
Created September 2, 2015 19:08
Set a custom contact item in android address book
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.my_app" >
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<!-- for syncing -->
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
@Sunno
Sunno / admin_utils.py
Last active August 29, 2015 14:19
Register all models from an app in django admin
__author__ = 'alvaro'
import inspect
from django.contrib import admin
import pyclbr
from django.db import models
def register_models(my_models):
"""
Call this from your admin.py in your app, this will register all your models
@Sunno
Sunno / keybase.md
Last active January 30, 2019 23:03

Keybase proof

I hereby claim:

  • I am sunno on github.
  • I am sunno (https://keybase.io/sunno) on keybase.
  • I have a public key ASCUqrv7zv12zZDrq5BhWpnn5HcAOTjs0rSdqLSzJBb9jwo

To claim this, I am signing this object:

@Sunno
Sunno / webhook.py
Last active July 3, 2019 09:58
Check mandrill webhook signature in django
"""
This has been adapted from http://www.ahwkong.com/post/2015/02/04/authenticate-mandrill-webhook-call/
Not my algorithm
"""
import hashlib
import hmac
from django.conf import settings
"""
@Sunno
Sunno / DateTimeUtils.java
Last active August 29, 2015 14:07
Parse Dates from and to ISO date format
/**
* Joda Time libraries required!
* You can get them here https://github.com/JodaOrg/joda-time/releases
*/
import org.joda.time.format.DateTimeFormatter;
import org.joda.time.format.ISODateTimeFormat;
import java.util.Calendar;
import java.util.Date;
@Sunno
Sunno / dict2.py
Created June 13, 2013 20:01
A child class from dict in python that add some extra features to dict, in this case conversion to json just create an instance and you have dict features together with new features.
'''
Created on 13/06/2013
@author: Alvaro Marquina
'''
import json
class dict2(dict):
'''
adds some functions to dict
@Sunno
Sunno / dabblet.css
Created August 17, 2012 18:14 — forked from CyberSliver/dabblet.css
E-mail address obfuscation
/**
* E-mail address obfuscation
*/
.domain::before {
width: 1em;
content: '@';
}