Skip to content

Instantly share code, notes, and snippets.

View kennydude's full-sized avatar

Joe Simpson kennydude

View GitHub Profile
@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 / 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 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 / 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 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 / 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 / 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 / Activity.java
Created August 29, 2012 13:43
ProgressBar in ActionBar
public boolean onCreateOptionsMenu(final Menu menu) {
// Inflate Layout here
// ProgressBar
if(isRefreshing){
ProgressBar p = new ProgressBar(this, null, android.R.attr.progressBarStyleSmall);
menu.findItem(R.id.refreshAction).setActionView(p).setEnabled(false);
}
// Do other crazy stuff here
@kennydude
kennydude / tumblr-unac.html
Created September 29, 2012 20:24
tumblr-unac.html
<div class="uac" style="background: #333; opacity: 0.9; position: absolute; top:0;left:0;bottom:0;right:0;display:none">
</div>
<div style="position: fixed; top: 50px; right: 0; left: 0; z-index: 999999999;display:none" class="uac">
<div style="background:#fff; margin: 0 auto; text-align: center; width:500px">
<h1>YOU ARE</h1>
<img src="http://25.media.tumblr.com/tumblr_mb4mphniug1qlqeu2o1_500.gif" />
</div></div>
<script type="text/javascript" src="http://code.jquery.com/jquery.js"></script>
<script type="text/javascript">
package me.kennydude.transtimetable.ui;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.util.StateSet;
public class TabBackgroundDrawable extends Drawable {