Skip to content

Instantly share code, notes, and snippets.

Jeremie Long lithid

Block or report user

Report or block lithid

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@lithid
lithid / logitech-bind-f13-f24.lua
Created Mar 14, 2019 — forked from ewauq/logitech-bind-f13-f24.lua
How to: Bind F13 to F24 keys on the G-keys (Logitech Gaming Keyboards)
View logitech-bind-f13-f24.lua
-- How to use this script:
-- 1. Install the Logitech Gaming Software: http://support.logitech.com/en_us/software/lgs
-- 2. Launch it, and right click on your profile (the gear icon) and then click on "Scripts".
-- 3. Add the following code into the Script window, save it, and close it. Enjoy.
-- Now G1 is bound to F13, G2 to G14, ... G12 to F24.
function OnEvent(event, arg)
-- OutputLogMessage("event = %s, arg = %s\n", event, arg)
@lithid
lithid / gist:7932148
Created Dec 12, 2013
Android PreferenceActivity fix
View gist:7932148
@TargetApi(Build.VERSION_CODES.KITKAT)
private void setupSimplePreferencesScreen() {
if (!isSimplePreferences(this)) {
return;
}
if (android.os.Build.VERSION.SDK_INT >= C.SDK_19) {
if (!isValidFragment(initialFragment)) {
throw new IllegalArgumentException("Invalid fragment for this activity: "
+ initialFragment);
@lithid
lithid / gist:7932076
Created Dec 12, 2013
Android 4.4 PreferenceActivity fix
View gist:7932076
@TargetApi(Build.VERSION_CODES.KITKAT)
private void setupSimplePreferencesScreen() {
if (!isSimplePreferences(this)) {
return;
}
if (android.os.Build.VERSION.SDK_INT >= C.SDK_19) {
if (!isValidFragment(initialFragment)) {
throw new IllegalArgumentException("Invalid fragment for this activity: "
+ initialFragment);
View gist:7564571
for x in `find . -type f -iname "*.png"`; do convert -colorspace gray $i gray-$i; done
View gist:7327067
public String getNetFile(String device, String url, boolean isJ) {
DefaultHttpClient defaultClient = new DefaultHttpClient();
String urlStr = url;
HttpGet httpGetRequest = new HttpGet(urlStr);
HttpResponse httpResponse = null;
try {
httpResponse = defaultClient.execute(httpGetRequest);
} catch (IllegalStateException e) {
return null;
} catch (IllegalArgumentException e) {
@lithid
lithid / Meh
Created Sep 1, 2013
Shown to show transparency
View Meh
@Override
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
boolean result;
final int save = canvas.save(Canvas.CLIP_SAVE_FLAG);
boolean drawScrim = false;
boolean mDrawBehind = true;
if (!mDrawBehind && mCanSlide && !lp.slideable && mSlideableView != null) {
View meh
import javax.swing.JOptionPane;
public class Main {
public static void main(String[] args){
String s;
s = JOptionPane.showInputDialog("Enter batch size: ");
Recipe.request = Double.parseDouble(s);
Recipe.factor = Recipe.request / Recipe.food;
for (int i = (int) r.z; i < Recipe.sFoodList.length; i++){
Recipe.sFoodList[i] = Recipe.factor * Recipe.sFoodList[i];
View Meh
//Main.java
import javax.swing.JOptionPane;
public class Main {
public static void main(String[] args){
String s;
Secondary f;
f = new Secondary();
View gist:6295819
#####
# OnClick
#####
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
new MessageTable(mContext).deleteItem(mMessageArray.get(position)[MESSAGE_ID]);
new MessageLoader().execute();
}
View gist:6284594
mRecorder = new MediaRecorder();
mRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mRecorder.setAudioChannels(2);
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
mRecorder.setAudioEncodingBitRate(96000);
mRecorder.setAudioSamplingRate(44100);
You can’t perform that action at this time.