Skip to content

Instantly share code, notes, and snippets.

View thedumbtechguy's full-sized avatar

TheDumbTechGuy thedumbtechguy

  • Wildcard Technologies
  • Accra, Ghana
View GitHub Profile
@thedumbtechguy
thedumbtechguy / nationality.html
Created December 5, 2016 15:42 — forked from didats/nationality.html
Nationality List in HTML Dropdown
<select name="nationality">
<option value="">-- select one --</option>
<option value="afghan">Afghan</option>
<option value="albanian">Albanian</option>
<option value="algerian">Algerian</option>
<option value="american">American</option>
<option value="andorran">Andorran</option>
<option value="angolan">Angolan</option>
<option value="antiguans">Antiguans</option>
<option value="argentinean">Argentinean</option>
@thedumbtechguy
thedumbtechguy / FolioGlidePage
Created May 19, 2016 14:14
A Folio Page that supports using Glide
import android.support.annotation.StringRes;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import com.bumptech.glide.RequestManager;
import com.bumptech.glide.manager.Lifecycle;
import com.bumptech.glide.manager.LifecycleListener;
@thedumbtechguy
thedumbtechguy / AndroidEncryptedMP3LocalHTTPServer.java
Last active October 31, 2022 19:19
A Local HTTP Streaming Server (LocalHTTPServer) for Android. This version was specifically made to stream encrypted MP3 files using a CipherInputStream to MediaPlayer but should be easily modified to work on ordinary files. It has been tested on API 9+ and works fine on large files (tested on up to 20MB files) and also supports range requests. I…
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
@thedumbtechguy
thedumbtechguy / Decrypt.java
Last active December 1, 2018 21:10
RSA Encrypt in PHP and Decrypt in Java (Android)
---Java
//I used this on Android
//before you proceed, you need to ensure your private key is PKCS8 since that is what can be read natively in java.
//If your key begins with -----BEGIN RSA PRIVATE KEY-----, the it is ssleay and you need to convert it using the openssl command below
//openssl pkcs8 -topk8 -inform pem -in ssleay-private-key.key -outform pem -nocrypt -out pkcs8-private-key.pem
final private static String RSA_PRIVATE_KEY =
"-----BEGIN PRIVATE KEY-----\n" +
"MI...\n" +
@thedumbtechguy
thedumbtechguy / SearchAdapter.java
Last active August 29, 2015 14:06
Android ListView Adapter To Display Different Views
package com.whisppa.app.adapter;
import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.whisppa.app.BaseActivity;
import com.whisppa.app.R;
@thedumbtechguy
thedumbtechguy / gist:23c9c88592723e8b2811
Last active August 29, 2015 14:05
Handling focus in Android media player
@Override
public void onPrepared(MediaPlayer mediaPlayer) {
mIsPrepared = true;
isLoadingNew = false;
mLostFocus = false;
if (startFocus() == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
initForeground();