Skip to content

Instantly share code, notes, and snippets.

#xinitrc
#!/bin/sh
# Start shit with this
exec ck-launch-session dbus-launch openbox-session
#autostart
#
# These things are run when an Openbox X Session is started.
# You may place a similar script in $HOME/.config/openbox/autostart
# to run user-specific things.
[lithid@ArchLinux ~]$ cat ~/.xinitrc
#!/bin/sh
# Start shit with this
exec ck-launch-session dbus-launch openbox-session
[lithid@ArchLinux ~]$ cat ~/.config/openbox/autostart
#
# These things are run when an Openbox X Session is started.
# You may place a similar script in $HOME/.config/openbox/autostart
# to run user-specific things.
@lithid
lithid / gist:4251170
Created December 10, 2012 15:15
OnTouchListener
public class MainActivity extends Activity implements OnTouchListener {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
GridView gv = (GridView) findViewById(R.id.grid);
gv.setOnTouchListener(this); // Uses onTouch override
}
@lithid
lithid / meh
Created February 1, 2013 16:37
<?php
$response = array();
require_once('db_connect.php');
$db = new DB_CONNECT();
# There are 6 variables tha can be used with this api
# id page count all order search
E/AndroidRuntime(13411): java.lang.RuntimeException: Unable to start receiver com.owentech.DevDrawer.receivers.AppInstalledReceiver: java.lang.IllegalStateException: Couldn't read row 0, col 2 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it.
E/AndroidRuntime(13411): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2507)
E/AndroidRuntime(13411): at android.app.ActivityThread.access$1500(ActivityThread.java:150)
E/AndroidRuntime(13411): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1320)
E/AndroidRuntime(13411): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(13411): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(13411): at android.app.ActivityThread.main(ActivityThread.java:5191)
E/AndroidRuntime(13411): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(13411): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(13411): at com.android.internal
@lithid
lithid / gist:5364182
Created April 11, 2013 15:12
objdump adb
[lithid@GnomeArch platform-tools]$ objdump -p adb
adb: file format elf32-i386
Program Header:
PHDR off 0x00000034 vaddr 0x08048034 paddr 0x08048034 align 2**2
filesz 0x00000100 memsz 0x00000100 flags r-x
INTERP off 0x00000134 vaddr 0x08048134 paddr 0x08048134 align 2**0
filesz 0x00000013 memsz 0x00000013 flags r--
LOAD off 0x00000000 vaddr 0x08048000 paddr 0x08048000 align 2**12
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);
#####
# 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();
}
//Main.java
import javax.swing.JOptionPane;
public class Main {
public static void main(String[] args){
String s;
Secondary f;
f = new Secondary();
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];