Skip to content

Instantly share code, notes, and snippets.

View ademar111190's full-sized avatar
Lightning Networking the Bitcoin

Ademar ademar111190

Lightning Networking the Bitcoin
  • CEO of Bitcoin
  • Itatiba
View GitHub Profile
@ademar111190
ademar111190 / README.md
Last active August 29, 2015 13:56
Restart adb as root on linux

##Restart ADB as root a linux utilitie to android developers

##how to use

###dependencies

Your adb need be on PATH variable
You need sudo access
@ademar111190
ademar111190 / extractIcon.sh
Created February 22, 2014 04:56
extract zips files from android ui utils
#!/bin/bash
# extract zips files from android ui utils:
# http://android-ui-utils.googlecode.com/hg/asset-studio/dist/index.html
# this is a GPL 3+ script
# author Ademar Alves de Oliveira <ademar111190@gmail.com>
# how to use:
# extractIcon.sh file_with_icons.zip destination/folder
#!/usr/bin/python
import sys
import argparse
import os
import re
'''
A simple script to create lower-resolution Android drawables from higher-resolution ones.
@ademar111190
ademar111190 / drc.sh
Created February 27, 2014 23:51
this is a more easy way of use the drawable_convert.py (https://gist.github.com/ademar111190/9261668) exaple of use: drc.sh image.png
#!/bin/bash
# this is a more easy way of use the drawable_convert.py
# https://gist.github.com/ademar111190/9261668
# this is a GPL 3+ script
# author Ademar Alves de Oliveira <ademar111190@gmail.com>
mkdir res res/drawable-hdpi res/drawable-mdpi res/drawable-xhdpi res/drawable-xxhdpi
mv $1 res/drawable-xxhdpi
drawable_convert.py -d res/drawable-mdpi -d res/drawable-hdpi -d res/drawable-xhdpi res/drawable-xxhdpi/$1
@ademar111190
ademar111190 / hexa.py
Created April 22, 2014 18:18
A script to generate current timestamp in hexadecimal
#!/usr/bin/python
'''
A script to generate current timestamp in hexadecimal
'''
from time import time
print hex(int(time()))
@ademar111190
ademar111190 / gist:453d5a7a4e75e7e5933f
Created June 26, 2014 21:25
Android & Java brazilian CPF and CEP pattern
import java.util.regex.Pattern;
public static final Pattern CPF = Pattern.compile("^([0-9]{3}\\.?){3}-?[0-9]{2}$");
public static final Pattern CEP = Pattern.compile("[0-9]{5}-?[0-9]{3}");
@ademar111190
ademar111190 / alah
Created October 22, 2014 16:32
Show one of ninety nine allah`s names
#!/usr/local/bin/lua
Alah = {}
Alah.__index = Alah
function Alah:new(latin, arabic, portuguese)
o = {}
setmetatable(o, self)
self.__index = self
self.latin = latin
@ademar111190
ademar111190 / exhaustion
Created March 7, 2015 21:34
Verify if 0 + 1 + 2 + ... + n is equals to (n * (n + 1)) / 2 by exhaustion
#!/usr/bin/env python
from time import time
'''
Verify if 0 + 1 + 2 + ... + n is equals to (n * (n + 1)) / 2, this
method is not using mathematical induction, it is using exhaustion
'''
def proof(n):
for i in range(n + 1):
@ademar111190
ademar111190 / lazyExample.java
Last active August 29, 2015 14:17
One month with Kotlin: lazy example
// Using Lazy on Kotlin
private val foo by Delegates.lazy { Foo(getContext()) }
//------------------------------------------------------------------------------
// Using the nearest from Lazy in Java 7
private Foo mFoo;
public Foo getFoo() {
if (mFoo == null) {
@ademar111190
ademar111190 / closureExample.java
Last active August 29, 2015 14:17
One month with Kotlin: closure example
// Using Closure on Kotlin
button.setOnClickListener {
Thread {
// Amazing! Just 2 identations, 5 lines and 55 characters "lesser than a half of tweet"
}.start()
}
//------------------------------------------------------------------------------
// Using the nearest from Closure in Java 7