Skip to content

Instantly share code, notes, and snippets.

View faruktoptas's full-sized avatar
🐝
I may be slow to respond.

Faruk Toptaş faruktoptas

🐝
I may be slow to respond.
View GitHub Profile
@faruktoptas
faruktoptas / jcompile.sh
Created August 22, 2013 19:25
Sublime Text 2 Java compile build settings. Place jcompile.sh in /usr/bin directory then make it executable.
#!/bin/bash
file=$1
basename="${file%%.*}"
javac $file
java $basename
@faruktoptas
faruktoptas / objkeys.js
Last active January 4, 2019 10:19
JS Object Keys
function objkeys(obj){
keys = Object.keys(obj);
var ret = "";
for (var o in keys){
ret = ret +keys[o] + "=>" + obj[keys[o]] + "\n";
}
return ret;
}
@faruktoptas
faruktoptas / gist:943a13767d92bf6648e0
Created June 10, 2014 07:40
Enable OS X App Store Debug mode
defaults write com.apple.appstore ShowDebugMenu -bool true
@faruktoptas
faruktoptas / bash
Created June 10, 2014 07:43
Useful bash commands
#find file
find . -name "*.*"
@faruktoptas
faruktoptas / aliases
Last active June 14, 2017 13:51
My bash_profile aliases
alias adbforw=./adb forward tcp:7777 tcp:7777
alias apkd=/.apktool d
alias apkb=/.apktool b
adb shell date $(date +%m%d%H%M%Y)
@faruktoptas
faruktoptas / build.gradle
Created October 22, 2015 08:25
Rename output apk file (append versionName)
android {
// ....
applicationVariants.all { variant ->
renameApk(variant, defaultConfig)
}
}
// ---------------------------
def renameApk(variant, defaultConfig) {
@faruktoptas
faruktoptas / PubKeyManager.java
Last active April 27, 2021 07:14
Public Key Pinning
public final class PubKeyManager implements X509TrustManager {
private String publicKey;
public PubKeyManager(String publicKey) {
this.publicKey = publicKey;
}
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
if (chain == null) {
@faruktoptas
faruktoptas / MainActivity.java
Last active September 25, 2018 10:29
Public Key Pinning Run
private void sendRequest() {
requestQueue = Volley.newRequestQueue(this, new HurlStack(null, pinnedSSLSocketFactory()));
StringRequest request = new StringRequest(Request.Method.GET, SECURE_URL, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Toast.makeText(MainActivity.this, "Response: " + response, Toast.LENGTH_SHORT).show();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
@faruktoptas
faruktoptas / .gitignore
Created February 3, 2016 08:33
Android .gitignore
# Built application files
*.apk
*.ap_
# Files for the Dalvik VM
*.dex
# Java class files
*.class
@faruktoptas
faruktoptas / FaRequestManager.java
Created March 14, 2016 10:00
A simple class to make GET and POST requests.
import android.net.SSLCertificateSocketFactory;
import android.os.AsyncTask;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;