Skip to content

Instantly share code, notes, and snippets.

@munho
munho / FragmentArgumentDelegate.kt
Created March 3, 2020 23:13 — forked from yanngx/FragmentArgumentDelegate.kt
Fragment arguments without hassle !
package be.brol
import android.os.Binder
import android.os.Bundle
import android.support.v4.app.BundleCompat
import android.support.v4.app.Fragment
/**
* Eases the Fragment.newInstance ceremony by marking the fragment's args with this delegate
* Just write the property in newInstance and read it like any other property after the fragment has been created
@munho
munho / ServiceGenerator.java
Created October 24, 2019 01:07 — forked from sjarifHD/ServiceGenerator.java
Retrofit2 Service Generator
public class ServiceGenerator {
private static final String API_BASE_URL = "https://api.github.com/";
private static Retrofit retrofit;
private static Gson mGson = new GsonBuilder()
.setDateFormat("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'SSS'Z'")
.create();
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import okhttp3.OkHttpClient;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
/**
* Created by mladenrakonjac on 01/06/16.
*/
public class ServiceGenerator {
@munho
munho / sub_qt.py
Created August 21, 2019 04:20 — forked from blubberdiblub/sub_qt.py
Minimal console output of a subprocess with PyQt.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QProcess, QTextCodec
from PyQt5.QtGui import QTextCursor
from PyQt5.QtWidgets import QApplication, QPlainTextEdit
@munho
munho / BBBautostartGUI.md
Created August 14, 2019 04:25
BBB Autostart a GUI
@munho
munho / pi_thunderboard.md
Last active April 12, 2019 04:37 — forked from hornej/pi_thunderboard.mdown
Raspberry Pi and Thunderboard help

Thunderboard Setup

I had a very difficult time following this tutorial so I am writing this to help me and other people. I would recommend following the directions in the tutorial using this page for reference if things go wrong.

I did this whole process on my Raspberry Pi 3 with Raspbian OS.

Following the GitHub doc

First things first: clone the repository.

git clone https://github.com/SiliconLabs/thundercloud.git

@munho
munho / SecureSharedPreferences.kt
Created January 10, 2019 08:20 — forked from FrancescoJo/SecureSharedPreferences.kt
A SharedPreferences wrapper implementation with encryption/decryption, using CipherHelper implementation.
import android.content.SharedPreferences
/**
* A [android.content.SharedPreferences] wrapper that helps easy reading/writing values.
*
* @author Francesco Jo(nimbusob@gmail.com)
* @since 22 - Mar - 2018
*/
class SecureSharedPreferences(private val sharedPref: SharedPreferences) {
fun contains(key: String) = sharedPref.contains(key)
@munho
munho / AndroidRsaCipherHelper.kt
Created January 10, 2019 08:19 — forked from FrancescoJo/AndroidRsaCipherHelper.kt
Android RSA cipher helper with system generated key. No more static final String key in our class - an approach which is very vulnerable to reverse engineering attack.
import android.os.Build
import android.security.KeyPairGeneratorSpec
import android.security.keystore.KeyGenParameterSpec
import android.security.keystore.KeyProperties
import android.util.Base64
import timber.log.Timber
import java.math.BigInteger
import java.security.GeneralSecurityException
import java.security.KeyPairGenerator
import java.security.KeyStore
@munho
munho / SimpleHTTPServerWithUpload.py
Created January 7, 2019 22:37 — forked from UniIsland/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
# -*- coding: utf-8 -*-
import sys
import threading
import queue
# from kivy.compat import queue
import serial
import time
import kivy
kivy.require('1.9.0')