This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.app.Activity; | |
// http://stackoverflow.com/questions/3874775/detect-my-apps-own-androidversioncode-at-run-time | |
public class GetVersion { | |
public static Integer getVersion(Activity activity) { | |
Integer version = 0; | |
try { | |
version = activity.getPackageManager().getPackageInfo(getPackageName(), 0).versionCode; | |
} catch (NameNotFoundException e) { | |
// Todo: handle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/android/platform_external_opencore/blob/master/pvmi/pvmf/include/pvmf_return_codes.h | |
use strict; | |
my $enumName = "VideoErrorCode"; | |
my $first = 1; | |
my %data; | |
for(<DATA>){ | |
chomp; | |
my ($msg,$code) = split /,/; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-eclipse-plugin</artifactId> | |
<version>2.8</version> | |
<configuration> | |
<excludes> | |
<exclude>com.google.android:android</exclude> | |
</excludes> | |
<buildOutputDirectory>bin</buildOutputDirectory> | |
<classpathContainers> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
my $repo="$ENV{HOME}/.m2/repository"; | |
my $cwd = `pwd`; | |
chomp($cwd); | |
my $localRepo=$cwd.'/lib'; | |
for(<DATA>) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -o errtrace | |
set -o errexit | |
facter_version=$1 | |
puppet_version=$2 | |
target_volume=$3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static javax.xml.bind.DatatypeConverter.parseBase64Binary | |
import static javax.xml.bind.DatatypeConverter.printBase64Binary; | |
import java.security.PrivateKey; | |
import java.io.ByteArrayOutputStream; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.IOException | |
public class Base64EncodedPrivateKey implements PrivateKey { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# mvn dependency:list | |
for(<DATA>){ | |
chomp; | |
s/\[INFO\]\s+//; | |
my ($g,$a,$t,$v,$s) = split /\:/; | |
`mvn install:install-file \\ | |
-DgroupId=$g \\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--changeset <user>:<rev> splitStatements:false | |
DO $$ | |
BEGIN | |
BEGIN | |
ALTER TABLE <table_name> ADD COLUMN <column_name> <column_type>; | |
EXCEPTION | |
WHEN duplicate_column THEN RAISE NOTICE 'column <column_name> already exists in <table_name>.'; | |
END; | |
END; | |
$$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- cf.: http://stackoverflow.com/a/2611745/87408 | |
SELECT | |
nspname AS schemaname,relname,reltuples | |
FROM pg_class C | |
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace) | |
WHERE | |
nspname NOT IN ('pg_catalog', 'information_schema') AND | |
relkind='r' | |
ORDER BY reltuples DESC; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## push a non-master branch 'yourbranch' to heroku | |
$ git push heroku yourbranch:master | |
## push a tag named 'v1.1' to heroku | |
$ git push -f heroku v1.1^{}:master |