Skip to content

Instantly share code, notes, and snippets.

Enrique López Mañas kikoso

Block or report user

Report or block kikoso

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Android Scene Europe.sql
;WITH USER_BY_TAG
AS
(
SELECT
ROW_NUMBER() OVER(ORDER BY COUNT(*) DESC) Rank,
u.Location,
COUNT(*) AS UpVotes
FROM Tags t
INNER JOIN PostTags pt ON pt.TagId = t.id
View Ask confirmation questions
#!/bin/sh
read -p "Have the feature been tested? (y/N):" answer
if [[ "$answer" != "y" ]]; then
exit 1
fi
read -p "Have you updated your Jira? (y/N):" answer
if [[ "$answer" != "y" ]]; then
exit 1
fi
read -p "Have you created a test version? (y/N):" answer
View Create Tag after merging
#!/bin/sh
name_of_branch=$(git branch | grep "*" | sed "s/\* //")
if [[ $name_of_branch == "master" ]]; then
read -p "Branch successfully merged on master. Please, specify tag version and click enter: " version
echo Creating tag with version "$version"
git tag -a v$version -m "$version"
fi
View Combined two files
#!/bin/sh
echo "Running detekt"
./gradlew detektCheck
result=$?
if [ "$result" = 0 ] ; then
echo "Detekt found no problems"
exit 0
else
View Run static analysis before commit
#!/bin/sh
echo "Running detekt"
./gradlew detektCheck
result=$?
if [ "$result" = 0 ] ; then
echo "Detekt found no problems"
exit 0
else
View Run tests before push
#!/bin/bash
command="./gradlew clean test"
echo "Executing tests before commit"
$command
result=$?
if [ "$result" -ne 0 ]; then
echo "Failed execution of tests"
exit 1
fi
exit 0
View callingNative.java
byte[] keyStart = getSecretKey().getBytes();
View ndkFunction.java
Java_com_example_exampleApp_ExampleClass_getSecretKey( JNIEnv* env,
jobject thiz )
{
return (*env)->NewStringUTF(env, "mySecretKey".");
}
View loadingANativeFunction.java
static {
System.loadLibrary("library-name");
}
public native String getSecretKey();
View usingEncryptAndDecrypt.java
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bm.compress(Bitmap.CompressFormat.PNG, 100, baos);
byte[] b = baos.toByteArray();
byte[] keyStart = "encryption key".getBytes();
KeyGenerator kgen = KeyGenerator.getInstance("AES");
SecureRandom sr = SecureRandom.getInstance("SHA1PRNG");
sr.setSeed(keyStart);
kgen.init(128, sr);
SecretKey skey = kgen.generateKey();
You can’t perform that action at this time.