Skip to content

Instantly share code, notes, and snippets.

🐿
Hiding nuts

Patrick Favre-Bulle patrickfav

🐿
Hiding nuts
Block or report user

Report or block patrickfav

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
@patrickfav
patrickfav / MultipleOrientationSlidingDrawer.java
Created Aug 20, 2013
My solution for a Sliding Drawer that can come from Top: I extracted SlidingTray from this lib http://aniqroid.sileria.com/doc/api/ (by Ahmed Shakil) and refactored it a bit since it had some quirks needed to be used within this lib. It consists of 1 class and you have to add atts in your attrs.xml. Other than that it has pretty much the same us…
View MultipleOrientationSlidingDrawer.java
package your.app;
/*
* Copyright (c) 2001 - 2012 Sileria, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@patrickfav
patrickfav / sigma-js-angular-app.js
Last active Apr 13, 2018
Simple Sigma.js AngularJs Directive: Since I did not find any angularjs directive for angularjs I created a little simple of my own. This is by no means a ready-for-all solutions, but all the features I needed at the time; it is easily extended to your needs and maybe sometimes somebody will do a full-blown directive for sigma.js Tested: angular…
View sigma-js-angular-app.js
/*
* Copyright 2017 Patrick Favre-Bulle
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@patrickfav
patrickfav / convert_cmyk.bat
Last active Aug 29, 2015
Windows Batch Imagemagick png to pdf wrapped cmyk-jpeg: pass path as paramter like so: .\convert_cmyk.bat C:\my-path-to-pngs\
View convert_cmyk.bat
@echo off
echo This script converts png files to cmyk colorspaced jpgs wrapped in pdf for latex
echo Start converting...
echo.
for %%f in (%~1*) do if /i %%~xf==.png (
echo Converting %%f to cmyk jpeg compressed %%~nf.pdf
convert %%f +profile "*" -profile "path/to/rgb.icc" -profile "path/to/cmyk.icc" -strip -sampling-factor 1x1 -quality 95 -compress JPEG %%~pf\%%~nf.pdf
)
@patrickfav
patrickfav / ImageUtil.java
Last active Oct 3, 2017
StackOverflow Question 36029295
View ImageUtil.java
/*
* Copyright 2017 Patrick Favre-Bulle
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
View scaling_36295066.java
/*
* Copyright 2017 Patrick Favre-Bulle
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@patrickfav
patrickfav / KeyStoreHelper.java
Created Sep 21, 2016 — forked from alphamu/KeyStoreHelper.java
Using Android KeyStore to generate a password. The code create a public/private key pair and uses the base64 encoded form of the certificate to as the password. The code modified the KeystoreHelper class from AOSP demo projects.
View KeyStoreHelper.java
/*
* Copyright 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@patrickfav
patrickfav / AndroidManifest.xml
Created Jan 30, 2017
Example for how to reproduce the restart bug in Seismic
View AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.company.seismicbug"
xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
View gist:d3ea9bfcb1669389f0bb52240bace1f3
MessageDigest digest = null;
try {
digest = MessageDigest.getInstance("SHA-256");
byte[] hash = digest.digest("hallo".getBytes(Charset.forName("UTF-8")));
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
Provider[] providers = Security.getProviders();
for (Provider provider : providers) {
@patrickfav
patrickfav / RandomOrgUtil.java
Last active Sep 27, 2017
Random.org Signed Response Verification (Java)
View RandomOrgUtil.java
/*
Copyright 2017 Patrick Favre-Bulle
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
You can’t perform that action at this time.