Skip to content

Instantly share code, notes, and snippets.

Avatar

neil saitug niftynei

View GitHub Profile
@niftynei
niftynei / gist:fe9b7395983877f91d4a
Created Dec 27, 2014
arch-linux VM bootstrap gist
View gist:fe9b7395983877f91d4a
fdisk
# Follow instructions!
mkfs.ext4 /dev/sda1
mkfs.ext4 /dev/sda2
mkdir /mnt/home
mount /dev/sda1 /mnt
mount /dev/sda2 /mnt/home
@niftynei
niftynei / Makefile
Created Dec 27, 2014
Working Basic Kernel Makefile
View Makefile
obj-m := hello.o
KDIR := /lib/modules/${uname -r}/build
PWD := ${shell pwd}
default:
${MAKE} -C ${KDIR} SUBDIRS=${PWD} modules
@niftynei
niftynei / gist:089591caccf53049bcd6
Created Jan 8, 2015
bluetooth connection error
View gist:089591caccf53049bcd6
01-08 14:10:25.748 3270-3477/com.example.client E/BluetoothConnection﹕ Exception communicating over bluetooth: bt socket closed, read return: -1
java.io.IOException: bt socket closed, read return: -1
at android.bluetooth.BluetoothSocket.read(BluetoothSocket.java:434)
at android.bluetooth.BluetoothInputStream.read(BluetoothInputStream.java:96)
at java.io.InputStream.read(InputStream.java:162)
at com.example.bluetooth.BluetoothConnection.run(BluetoothConnection.java:99)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:152)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:265)
@niftynei
niftynei / gist:999b6a323b5503a9f846
Created Mar 16, 2015
Thread dump. AS was frozen, unplugging USB to connected device fixed the issue.
View gist:999b6a323b5503a9f846
Full thread dump Java HotSpot(TM) 64-Bit Server VM (20.65-b04-466.1 mixed mode):
"Attach Listener" daemon prio=9 tid=11bc87800 nid=0x11ed4e000 waiting on condition [00000000]
java.lang.Thread.State: RUNNABLE
Locked ownable synchronizers:
- None
"JobScheduler FJ pool 0/4" daemon prio=6 tid=11bd05000 nid=0x11ee51000 waiting on condition [11ee50000]
java.lang.Thread.State: TIMED_WAITING (parking)
View gist:589ae5a00b8343b84b41
public static final String LESS_THAN_A_MINUTE = "less than a minute";
public static final String SECONDS = "seconds";
public static final String MINUTES = "minutes";
public static final String HOURS = "hours";
public static final String DAYS = "days";
public static final String WEEKS = "weeks";
public static final String MONTHS = "months";
public static final String YEARS = "years";
public static final String DECADES = "decades";
public static final String CENTURIES = "centuries";
View keybase.md

Keybase proof

I hereby claim:

  • I am niftynei on github.
  • I am niftynei (https://keybase.io/niftynei) on keybase.
  • I have a public key whose fingerprint is 2650 32C4 4A7D 47F1 519B 1A4C 1F62 C1C0 E516 DDF5

To claim this, I am signing this object:

@niftynei
niftynei / LoginView.java
Last active Aug 31, 2015
LoginView.java
View LoginView.java
package com.electricobjects.client.login;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.os.Build;
import android.os.SystemClock;
import android.text.Html;
import android.text.InputType;
import android.text.Spannable;
@niftynei
niftynei / details.java
Last active Sep 1, 2015
Making it rain expandable textz
View details.java
package com.electricobjects.client.collections;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.support.v7.widget.RecyclerView;
import android.text.Editable;
import android.text.Layout;
import android.text.Spannable;
@niftynei
niftynei / chooser.java
Created Sep 9, 2015
adding a camera thing
View chooser.java
/**
* Utility to start an image picker with request code
*
* @param activity Activity that will receive result
* @param requestCode requestCode for result
*/
public static void pickImage(Activity activity, int requestCode, Uri cameraPhotoUri) {
if (activity.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY)) {
Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
Intent imageOnDiskIntent = new Intent(Intent.ACTION_GET_CONTENT).setType("image/*");
@niftynei
niftynei / sudo.sh
Last active Sep 22, 2015
sudo but sudon't
View sudo.sh
$ which python
/usr/bin/python
$ sudo which python
/usr/bin/python
$ python -c "import cairo; print cairo.version"
1.10.0
$ sudo python -c "import cairo; print cairo.version"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/cairo/__init__.py", line 1, in <module>
You can’t perform that action at this time.