Skip to content

Instantly share code, notes, and snippets.

View sr105's full-sized avatar

Harvey Chapman sr105

View GitHub Profile
@sr105
sr105 / DynamicLibLoader.java
Created February 23, 2015 19:06
Dynamic Library Loader for Android
package com.rdm.neocastapp;
import android.content.ContextWrapper;
import android.util.Log;
import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import dalvik.system.DexClassLoader;
@sr105
sr105 / long_double.cpp
Created February 17, 2015 14:00
examples of C++ floating point types
#include <stdio.h>
int main() {
float f = 99998.1F;
double d = 99998.1;
long double ld = 99998.1L;
printf("sizeof(f) = %lu\n", sizeof(f));
printf("sizeof(d) = %lu\n", sizeof(d));
printf("sizeof(ld) = %lu\n", sizeof(ld));
@sr105
sr105 / gist:1b562519f7cafbf25a14
Last active August 29, 2015 14:12
e-mail about case colisions and revert
From: "Harvey Chapman" <hchapman-hg@3gfp.com>
Subject: revert and remove, filename case collision behavior
Summary:
1. Is "hg revert -a" supposed to give errors for filename case collision? I discovered that since it doesn’t, it makes for a nice way to clean up collisions on case-insensitive filesystems.
2. Also, hg remove acts a little odd when asked to remove a case collision filename. Examples below.
[ There would be an email here but the list server thinks it’s spam no matter how I send it and from where ]
#! /bin/bash
# Description: show dependency tree
# Author: damphat
if [ $# -lt 1 ]; then
echo 'Usage: apt-rdepends-tree [-r] <package>'
echo 'Required packages: apt-rdepends'
exit 1
fi
@sr105
sr105 / solution.java
Created December 7, 2014 23:22
send command to UI thread using a message containing the command and a place to put the response. The sender waits for the UI using a CountDownLatch
// In background thread:
Handler uiHandler;
public void test() {
Command command = new Command();
// fill command
Response response = send(command);
}
public Response send(Command command) {
@sr105
sr105 / PhotoGalleryFragment.java
Created December 6, 2014 22:08
gridview with square cells, look at setupAdapter()
package com.rdm.photogallery;
import java.util.ArrayList;
import android.app.Activity;
import android.app.Fragment;
import android.app.SearchManager;
import android.app.SearchableInfo;
import android.content.ComponentName;
import android.content.Context;
@sr105
sr105 / gist:deee15c0402fa80e49b2
Last active August 29, 2015 14:08
keybase.md
### Keybase proof
I hereby claim:
* I am sr105 on github.
* I am harvey (https://keybase.io/harvey) on keybase.
* I have a public key whose fingerprint is A1BA 4D60 4D34 6A20 7A99 2832 F94E 94DC 000B BDD7
To claim this, I am signing this object:
[30] [lab 21064 NP93-2930 4.4.0-cde4 003018134F17] [192.168.25.105] ~
$ dpkg -l | grep linux-image
ii linux-image-3.13.0-34-generic 3.13.0-34.60 i386 Linux kernel image for version 3.13.0 on 32 bit x86 SMP
ii linux-image-extra-3.13.0-34-generic 3.13.0-34.60 i386 Linux kernel extra modules for version 3.13.0 on 32 bit x86 SMP
ii linux-image-generic 3.13.0.34.40 i386 Generic Linux kernel image
[31] [lab 21064 NP93-2930 4.4.0-cde4 003018134F17] [192.168.25.105] ~
$ uname -r
3.13.0-34-generic
@sr105
sr105 / gist:9a86ea8709694ab24cef
Created July 9, 2014 18:24
gstreamer1.0-plugins-bad --enable-quicktime configure output
hchapman@mint /oe/tmp/tmp/work/cortexa9hf-vfp-neon-mx6-poky-linux-gnueabi/gstreamer1.0-plugins-bad/1.2.4-r0/gst-plugins-bad-1.2.4 $ cat ../tem
DEBUG: Executing python function sysroot_cleansstate
DEBUG: Python function sysroot_cleansstate finished
DEBUG: SITE files ['endian-little', 'bit-32', 'arm-common', 'common-linux', 'common-glibc', 'arm-linux', 'arm-linux-gnueabi', 'common']
DEBUG: Executing shell function autotools_preconfigure
DEBUG: Shell function autotools_preconfigure finished
DEBUG: Executing python function autotools_copy_aclocals
DEBUG: Python function autotools_copy_aclocals finished
DEBUG: Executing shell function delete_liblink_m4_file
Desktop$ hg init TestHg
Desktop$ cd TestHg/
TestHg$ touch A
TestHg$ hg ci -Am "First A"
adding A
TestHg$ mkdir sub1
TestHg$ hg cp A sub1/A
TestHg$ hg ci -Am "sub1 A"
TestHg$ mkdir sub2
TestHg$ hg cp A sub2/A