Skip to content

Instantly share code, notes, and snippets.

View gipi's full-sized avatar
😎
code for food

Gianluca Pacchiella gipi

😎
code for food
View GitHub Profile
@dmytrodanylyk
dmytrodanylyk / ShadowLayout.java
Last active August 29, 2015 14:15
ShadowLayout
public class ShadowLayout extends FrameLayout implements ViewGroup.OnHierarchyChangeListener {
private int mBackgroundColor;
private int mShadowColor;
private float mShadowRadius;
private float mCornerRadius;
private float mDx;
private float mDy;
private Paint mPaint;
@gipi
gipi / gist:1506702
Last active September 28, 2015 22:38
#unix
@avh4
avh4 / MyActivityUnitTest.java
Created December 9, 2011 09:36
how to make an ActivityUnitTestCase that depends on a ContentProvider use test databases
@Override
protected void setUp() throws Exception {
super.setUp();
// Create a Context for our content provider that will use the test.*
// database instead of the production database
final String filenamePrefix = "test.";
final RenamingDelegatingContext testDatabaseContext = new RenamingDelegatingContext(
getInstrumentation().getTargetContext(), getInstrumentation()
.getTargetContext(), filenamePrefix);
@mpost
mpost / Entry.java
Created September 18, 2013 11:50
Android application demonstrating the usage of ViewOverlay and OnPreDrawListener to achieve animations effects.
package com.example.overlay;
public class Entry {
private final int imageResId;
private final String title;
public Entry( int imageResId, String title ) {
this.imageResId = imageResId;
@rupey
rupey / mandelbrot.sql
Last active December 7, 2020 05:38
Mandelbrot plot in postgres
WITH RECURSIVE
x(i) AS ( VALUES (0)
UNION ALL SELECT i + 1
FROM x
WHERE i < 101),
Z(Ix, Iy, Cx, Cy, X, Y, I) AS (
SELECT
Ix,
Iy,
X :: FLOAT,
@AGWA
AGWA / cook_rsa_key.go
Last active April 13, 2021 15:36
Demonstrates that an RSA signature does not uniquely identify a public key.
/*
* Demonstrates that an RSA signature does not uniquely identify a public key.
* Given a signature, s, and a message m, it's possible to construct a new RSA key
* pair such that s is a valid signature for m under the new key pair.
*
* Requires Go version >= 1.5. Go <= 1.4 doesn't work due to a bug in the bignum
* package: https://github.com/golang/go/issues/9826
*
* Written in 2015 by Andrew Ayer <agwa@andrewayer.name>
*
@cgibson
cgibson / fabric_wrapper_test.py
Created October 21, 2012 02:28
Run fabric commands in unittests using a function wrapper
import unittest
from fabric.api import env, execute, run, task
from functools import wraps
#
# Fabric command wrapper. Essentially, this surrounds any specified command
# call with the execute() function. Adding this function decoration to unit-
# tests allows us to avoid using execute() functions within our tests.
#