Skip to content

Instantly share code, notes, and snippets.

@paddycarver
paddycarver / themes.md
Created June 11, 2014 19:33
Big list of release naming themes
  • Game of Thrones characters
  • First generation Pokémon,
  • 90s TV show characters/catch phrases/references
  • Rejected Girl Scout cookie flavours
  • Disney characters
  • Famous dead people
  • Famous living people
  • Catastrophic events from history
  • Things you find on instagram
  • Notable tax protesters
@paddycarver
paddycarver / itertest.go
Last active August 29, 2015 14:04
itertest.go contains a test for how many iterations of PBKDF2 and SHA-256 you need to make hashing take at least 1 second. pass.go contains helper functions for working with passwords.
package main
import (
"crypto/rand"
"crypto/sha256"
"fmt"
"time"
"code.google.com/p/go.crypto/pbkdf2"
)
package main
import (
"net/http"
"github.com/gorilla/mux"
)
func main() {
http.Handle("/", getRouter())
path := strings.TrimRight(os.Getenv("GOPATH"), "/") + "/src/github.com/DramaFever/go-logging/log.go"
line := 463
if testing.Coverage() > 0 {
path = "github.com/DramaFever/go-logging/_test/_obj_test/log.go"
line = 448
}
$ cat /proc/meminfo
MemTotal: 3800808 kB
MemFree: 163492 kB
MemAvailable: 2301612 kB
Buffers: 147920 kB
Cached: 2088052 kB
SwapCached: 0 kB
Active: 2386304 kB
Inactive: 999916 kB
Active(anon): 1150640 kB
@paddycarver
paddycarver / makefile
Created August 10, 2015 23:29
Run `go vet` on all the Go packages in a directory, then run all their tests, writing test coverage reports to `coverage/pkg.path.out`
SUBPACKAGES := $(foreach pkg,$(sort $(dir $(shell find . -type f -name '*.go'))),$(patsubst %/,%,${pkg}))
# run tests with coverage reports.
test:
@${GO} vet ./...
@mkdir -p coverage
@for pkg in ${SUBPACKAGES}; do \
go test $$pkg -v -coverprofile=coverage/$${pkg/\//.}.out; \
done
String sdCard = android.os.Environment.getExternalStorageDirectory().getPath();
String root = sdCard + "/com.yourapp/";
public static void makeDir(String dir){
File fileObj = new File(root+dir);
fileObj.mkdir();
}
public static void sdCardMountCheck() {
String state = android.os.Environment.getExternalStorageState();
if(android.os.Environment.MEDIA_MOUNTED.equals(state)) {
sdCardReadable = true;
sdCardWritable = true;
}else if(android.os.Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
sdCardReadable = true;
sdCardWritable = false;
}else{
sdCardReadable = false;
package com.suchagit.android2cloud.util;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.HttpEntityEnclosingRequest;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
package com.suchagit.android2cloud.util;
import java.util.List;
import org.apache.http.NameValuePair;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.message.BasicNameValuePair;
public class AddLinkRequest extends HttpPost {