Skip to content

Instantly share code, notes, and snippets.

View Nimrodda's full-sized avatar

Nimrod Dayan Nimrodda

View GitHub Profile
@Nimrodda
Nimrodda / .bash_profile
Last active January 13, 2018 12:36
Bash Profile with git autocompletion
export ANDROID_HOME="/Users/nimrod/Library/Android/sdk"
export ANDROID_NDK="/Users/nimrod/Library/Android/sdk/ndk-bundle"
export ANDROID_SDK_HOME=$ANDROID_HOME
export ANDROID_NDK_HOME=$ANDROID_NDK
export JAVA_HOME=`/usr/libexec/java_home`
#export STUDIO_JDK=`/usr/libexec/java_home -v 1.6`
export MAVEN_OPTS=-Djava.awt.headless=true
export GIT_SSL_NO_VERIFY=true
export PATH=$HOME/.fastlane/bin:/usr/local/git/bin:$PATH:~/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools/bin
@Nimrodda
Nimrodda / lighttpd.conf
Created March 28, 2014 13:13
lighttpd.conf
#Lighttpd configured as a https proxy server
server.modules = (
"mod_access",
"mod_alias",
"mod_compress",
"mod_redirect",
#"mod_rewrite",
"mod_proxy",
)
@Nimrodda
Nimrodda / JNI.cpp
Last active March 8, 2021 09:35
Raw JNI with async callbacks
static jclass callbacksClass;
static jobject callbacksInstance;
JNIEXPORT void JNICALL Java_com_example_NativeClass_nativeMethod(JNIEnv* env, jclass callingObject, jobject callbacks)
{
// Cache the Java callbacks instance
callbacksInstance = env->NewGlobalRef(callbacks);
// Cache the Java callbacks class (in case of interface, this will be the concrete implementation class)
jclass objClass = env->GetObjectClass(callbacks);
@Nimrodda
Nimrodda / Android.mk
Created March 5, 2015 14:36
Sample Android.mk with prebuilt static library
LOCAL_PATH := $(call my-dir)
# hatch library
include $(CLEAR_VARS)
LOCAL_MODULE := prebuilt-static-lib
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libprebuilt-static-lib.a
# The header files should be located in the following dir relative to jni/ dir
LOCAL_EXPORT_C_INCLUDES := include/
include $(PREBUILT_STATIC_LIBRARY)
@Nimrodda
Nimrodda / Log.h
Last active July 17, 2020 09:33
Simple log header with log levels for Android NDK library
#pragma once
#include <android/log.h>
#define LOG_VERBOSE 1
#define LOG_DEBUG 2
#define LOG_INFO 3
#define LOG_WARN 4
#define LOG_ERROR 5
@Nimrodda
Nimrodda / Git Tricks.md
Last active September 5, 2017 07:40
Git Tricks

Delete tracked files in directory: git ls-files -z | xargs -0 rm -rf

Delete a file from history of a branch: git filter-branch --index-filter "git rm --cached -f --ignore-unmatch <path/filename>"

See log with files changed: git log --name-status

Delete remote branch:

@Nimrodda
Nimrodda / commands.md
Created April 5, 2015 16:17
Linux commands

FTP command line

ncftp

ncftpput -R -v -u "username" ftp.nixcraft.biz /nixcraft/forum /tmp/phpbb
 
Where,
@Nimrodda
Nimrodda / ChatService.java
Created March 20, 2017 12:51
Android Bound Service and MVP
public class ChatService extends Service {
public class LocalBinder extends Binder {
public MessagingService getService() {
return ChatService.this.mMessagingService;
}
}
private final IBinder mBinder = new LocalBinder();
@Inject MessagingService mMessagingService;
@Nimrodda
Nimrodda / osx_bootstrap.sh
Last active March 11, 2023 15:41 — forked from codeinthehole/osx_bootstrap.sh
Script to install all the required tools needed for Android development on a new MacOS machine
#!/bin/bash
#
# Bootstrap script for setting up a new OSX machine
#
# This should be idempotent so it can be run multiple times.
#
# Notes:
#
# - If installing full Xcode, it's better to install that first from the app
# store before running the bootstrap script. Otherwise, Homebrew can't access
dependencies {
def version = "2.2.0"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$version"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$version"
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$version"
// or lifeycle-compiler if not using Java 8
//kapt "androidx.lifecycle:lifecycle-compiler:$version"
implementation "androidx.activity:activity-ktx:1.1.0"
implementation "androidx.fragment:fragment-ktx:1.2.1"
}