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
@jdewit
jdewit / vim74_lua
Last active January 30, 2024 04:57
Installing vim 7.4 with lua on Ubuntu 12.04
sudo apt-get remove --purge vim vim-runtime vim-gnome vim-tiny vim-common vim-gui-common
sudo apt-get build-dep vim-gnome
sudo apt-get install liblua5.1-dev luajit libluajit-5.1 python-dev ruby-dev libperl-dev libncurses5-dev libgnome2-dev libgnomeui-dev libgtk2.0-dev libatk1.0-dev libbonoboui2-dev libcairo2-dev libx11-dev libxpm-dev libxt-dev
sudo rm -rf /usr/local/share/vim
sudo rm /usr/bin/vim
anonymous
anonymous / error.json
Created August 3, 2013 05:25
{
"success":false,
"response":[{
"tipo":"TIPO ERROR",
"error":"ERROR 123",
"exception":"EXCEPTION MESSAGE"
}]
}
@eveliotc
eveliotc / RoundedAvatarDrawable.java
Created July 22, 2013 04:59
RoundedAvatarDrawable: A Drawable that draws an oval with given {@link Bitmap} See http://evel.io/2013/07/21/rounded-avatars-in-android/
/*
* Copyright 2013 Evelio Tarazona Cáceres <evelio@evelio.info>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@alexfu
alexfu / FragmentObserver.java
Last active April 6, 2021 03:26
Observer pattern for notifying Fragments of a ViewPager to update their views. This will update the current Fragment, as well as the off screen Fragments that are retained.
public class FragmentObserver extends Observable {
@Override
public void notifyObservers() {
setChanged(); // Set the changed flag to true, otherwise observers won't be notified.
super.notifyObservers();
}
}
@Udinic
Udinic / TasksContract.java
Last active October 12, 2018 15:34
A contract class to work with Any.do's Content Provider. A full guide is available at http://tech.any.do/content-provider-for-any-do/
/**
* This class provides the URI and const values to work with Any.do's Content Provider.
*
* A guide is available on http://tech.any.do/content-provider-for-any-do/
*/
public class TasksContract {
public static final Uri TASKS_URI = Uri.parse("content://com.anydo.provider/tasks");
public static final Uri FOLDERS_URI = Uri.parse("content://com.anydo.provider/folders");
public static final String PERMISSION_READ = "com.anydo.provider.permission.READ_ANYDO_TASKS";
@slickplaid
slickplaid / install_wkhtmltopdf.sh
Last active September 11, 2022 12:51
How to install version 0.12.0 (latest as of 5/10/13) of wkhtmltopdf on Ubuntu 12.04 LTS headless server.
sudo apt-get update && sudo apt-get upgrade -y;
sudo apt-get build-dep -y libqt4-gui libqt4-network libqt4-webkit;
sudo apt-get install -y openssl build-essential xorg git git-core libssl-dev libxrender-dev t1-xfree86-nonfree xfonts-scalable ttf-ubuntu-font-family ttf-mscorefonts-installer poppler-utils libqt4-dev qt4-dev-tools;
cd ~;
git clone git://gitorious.org/~antialize/qt/antializes-qt.git wkhtmltopdf-qt;
git clone git://github.com/antialize/wkhtmltopdf.git wkhtmltopdf;
cd wkhtmltopdf;
qmake-qt4;
cd ../wkhtmltopdf-qt;
git checkout 4.8.4;
@pmdarrow
pmdarrow / gist:3427827
Created August 22, 2012 17:40
How to compile wkhtmltopdf static binary on Ubuntu 12.04
# These instructions were tested on Ubuntu 12.04 64bit
# Be prepared to wait a while...
sudo apt-get install openssl build-essential xorg libssl-dev libxrender-dev libxext-dev libpq-dev libx11-dev
git clone git://github.com/antialize/wkhtmltopdf.git
git clone git://gitorious.org/+wkhtml2pdf/qt/wkhtmltopdf-qt.git wkhtmltopdf-qt
cd wkhtmltopdf
mkdir static-build
ln -s ../wkhtmltopdf-qt static-build/qt
./scripts/static-build.sh
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active June 7, 2024 15:14
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@mikeyk
mikeyk / redis_session_backend.py
Created April 8, 2011 18:01
A redis backend for Django Sessions, tested on Django 1.3+
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.conf import settings
from django.utils.encoding import force_unicode
import redis
class SessionStore(SessionBase):
""" Redis store for sessions"""
def __init__(self, session_key=None):
self.redis = redis.Redis(