Skip to content

Instantly share code, notes, and snippets.

View avianey's full-sized avatar
🏕️
Living

Antoine Vianey avianey

🏕️
Living
View GitHub Profile
@avianey
avianey / gist:497f9c69d198ea7dd59b
Created October 11, 2014 14:02
Libgdx square AndroidFragmentApplication that fills as much of the screen as possible
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
config.useAccelerometer = false;
config.useCompass = false;
config.useWakelock = true;
config.numSamples = 1;
config.resolutionStrategy = new ResolutionStrategy() {
@Override
public MeasuredDimension calcMeasures(int widthMeasureSpec, int heightMeasureSpec) {
int width = widthMeasureSpec;
@avianey
avianey / astro.py
Last active September 10, 2015 13:55 — forked from pepijndevos/astro.py
import math
class Planet(object):
def __init__(self, name, a, e, i, l, lp, ln,
ac, ec, ic, lc, lpc, lnc):
self.name = name
self.a = a
self.ac = ac
self.e = e
@avianey
avianey / Curated JS Links
Created January 19, 2017 08:09
Curated JS Links
@avianey
avianey / ca cert
Last active August 24, 2017 09:31
Self signed client / server certificat
openssl genrsa -out ca.key 2048
openssl req -new -key ./ca.key -out ./ca.csr
openssl x509 -req -days 365 -in ./ca.csr -out ./ca.crt -signkey ./ca.key
openssl x509 -in ca.crt -text
openssl rsa -in ca.key -passin pass:XXXX -pubout -out ca.public.key
@avianey
avianey / LibGDXCardDeck.java
Last active October 3, 2017 13:55
Generates LibGDX BitmapFont and TextureAtlas at build time with Gradle
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
java -jar apktool.jar d 321.apk
java -jar apktool.jar b 321 -o 323.apk
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ./your.keystore 323.apk alias
[android-sdk]/build-tools/27.0.2/zipalign -v 4 323.apk 323-aligned.apk
@avianey
avianey / BusinessExceptionMapper.java
Last active June 18, 2019 09:19
Jersey custom parameter, annotation and exception mapping
@Provider
public class BusinessExceptionMapper implements ExceptionMapper<BusinessException> {
private static final Logger log = Logger.getLogger(TestEndpoint.class.getName());
private static final ResourceBundle resource =
ResourceBundle.getBundle("com.blogspot.avianey");
@Override
public Response toResponse(BusinessException e) {
class SampleCode {
public static void main(String[] args) {
// TODO
}
}
@avianey
avianey / Activity.java
Last active November 19, 2019 14:35
Add Tab with custom click handler along with ViewPager Android Material component
TabLayout tabLayout = findViewById(R.id.tabs);
if (tabLayout != null) {
tabLayout.setupWithViewPager(
pager,
false // avoid listen for change of items in the adapter
);
try {
// Add custom tabs with managed click handler
Method m = tabLayout.getClass().getDeclaredMethod("createTabView", TabLayout.Tab.class);
m.setAccessible(true);
@avianey
avianey / DisplayLink-DellXPS15-Ubuntu18.sh
Created November 22, 2019 09:41
Make displaylink D3100 Dell docking station work with Dell XPS15 running ubuntu 18.04