Skip to content

Instantly share code, notes, and snippets.

View kennydude's full-sized avatar

Joe Simpson kennydude

View GitHub Profile
@kennydude
kennydude / FragmentAdapter.java
Created July 28, 2012 18:07
FragmentAdapter Example
import java.util.ArrayList;
import java.util.List;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.ViewPager;
import android.util.Log;
import android.view.ViewGroup;
@kennydude
kennydude / Java.java
Created July 14, 2012 14:31
Encrypt from Java and decrypt on Node.js
// Encrypt where jo is input, and query is output and ENCRPYTION_KEy is key
byte[] input = jo.toString().getBytes("utf-8");
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] thedigest = md.digest(ENCRYPTION_KEY.getBytes("UTF-8"));
SecretKeySpec skc = new SecretKeySpec(thedigest, "AES/ECB/PKCS5Padding");
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, skc);
byte[] cipherText = new byte[cipher.getOutputSize(input.length)];
@kennydude
kennydude / README.markdown
Created June 9, 2012 14:18
University course pulers

Usage:

Call with python uni.py on the command line and it will ask the university. Then follow on-screen instructions

Supported:

  • Newcastle University (ncl). Should work for all courses, only tested on Computing
  • Birmingham University Computing School. Only this department because of the way it's organized

Will output in plain unstyled HTML with each module's Aims and Syllabus instead of manually doing it.

@kennydude
kennydude / README.markdown
Created June 5, 2012 19:00
YouTube Manual View

You need to put this on a webserver locally

  • No login, so insecure

  • AJAX refreshing

  • No shit, just subscriptions

  • Add bootstrap into it's directory to make it look respectable

The script needs access to files:

@kennydude
kennydude / README.markdown
Created April 12, 2012 19:48
Glyphicons Index

Simple,

Place the php file under the glyphicons directory (not the halflings) and then add that to a webserver (I just symlink the glyphicons directory under /var/www)

And tada! :D

@kennydude
kennydude / videoview.html
Created March 19, 2012 14:53
Video view for Tumblr
<!DOCTYPE HTML>
<html>
<!-- Copied from David Karp. David, you're sexy and you know it so please don't delete it. -->
<head>
<script type="text/javascript">
// Configuration
var tag = 'big pictures';
var batch_size = 10;
</script>
@kennydude
kennydude / README.markdown
Created December 15, 2011 19:05
MCP Modifications

Hi, I have made some changes to MCP http://mcp.ocean-labs.de/

If you apply my changes, what you can do is:

  • Make a mods/YOURNAME folder and place any new Java files or PNG sprites and they will automatically work in Minecraft
  • Enable/Disable these folders

In the config, the mod called "kennydude" is switched on.

There is probably a lot to be changed (for example, I pulled in JSON parsing which may not be what you want).

@kennydude
kennydude / FlushCheckBoxPreference.java
Created December 4, 2011 12:25
Default Value flushable preferences in Android
import android.content.Context;
import android.preference.CheckBoxPreference;
import android.util.AttributeSet;
public class FlushCheckBoxPreference extends CheckBoxPreference implements FlushPreferences {
public FlushCheckBoxPreference(Context context, AttributeSet a) {
super(context, a);
}
@kennydude
kennydude / fixtags.py
Created August 19, 2011 13:38
Fix tags
'''
Problem tags?
For now it only fixes ogg files, sorry!
Just run it where it's just under your music folder or modify the code as needed
'''
print "TAG FIXER!"
import glob, subprocess, os, mutagen
from mutagen.easyid3 import EasyID3
@kennydude
kennydude / AndroidExport.py
Created July 19, 2011 17:39
Photoshop Exporter for Android Assets!
import win32com.client
psApp = win32com.client.Dispatch("Photoshop.Application")
print "Please make sure you have the current document open and saved in the base of your project as we're going to save it by dpi NOW."
print "You also need the document in 320dpi for this to work properly!"
try:
var = input("Press enter")
except:
pass
import os