Skip to content

Instantly share code, notes, and snippets.

source ~/.bashrc
source ~/python-projects/virtualenv/activate
#!/bin/sh
# venv_switch.sh
# switch between different virtual environments
# verify a virtualenv is passed in
if [ $# -ne 1 ]
then
echo 'Usage: venv_switch venv-label'
exit -1
fi
@yareally
yareally / SignalStrength.java
Created September 14, 2013 08:01
ugly decompiled signalstrength class from a hwu8185 that keeps crashing my signal app. Damn cheap ass devices ignore the proper way to do toString() for the API.
package android.telephony;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
public class SignalStrength
implements Parcelable
{
@yareally
yareally / FakeLambda.java
Last active December 20, 2015 22:09
Ugly fake Java Lambdas
package helpers;
import java.util.ArrayList;
import java.util.List;
/**
* @author Wes Lanning
* @version 2013-08-01
*/
public class FakeLambda
package models;
import java.util.*;
import javax.persistence.*;
import play.db.ebean.*;
import play.data.format.Formats.*;
import play.data.format.Formatters.*;
import play.data.validation.Constraints.*;
@yareally
yareally / ramdrive.cmd
Last active December 20, 2015 21:39
initialize ram drive
:: Guides and examples can be found at:
:: http://forums.guru3d.com/showthread.php?t=356046
:: Script needs to be set as a system startup batch file (with event schedular, not the "startup directory") with the highest priority and system privilages to work correctly.
:: Init the ramdrive (12GB) in physical memory and format it as ntfs
imdisk -a -s 12G -m R: -p "/fs:ntfs /q /y" -o awe
:: add a page file starting with 96MB and expands to 1536M
swapadd R:\pagefile.sys 96M 1536M
class Greeter {
element: HTMLElement;
span: HTMLElement;
timerToken: number;
constructor(element: HTMLElement) {
this.element = element;
this.element.innerHTML += "The time is: ";
this.span = document.createElement('span');
this.element.appendChild(this.span);
@yareally
yareally / Test.scala
Last active March 30, 2016 15:45
Basic usage example of Scala's async/await (https://github.com/scala/async) on Android
/*
Copyright (c) 2013 Wes Lanning, http://codingcreation.com
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@yareally
yareally / Test.scala
Last active December 19, 2015 10:38
scala async/await on android
package com.cc.json2csv
import android.app.Activity
import android.os.Bundle
import play.api.libs.json._
import android.widget.TextView
import android.util.Log
import scala.async.Async.{async, await}
import scala.concurrent.{Await, Future, ExecutionContext, future}
import scala.concurrent.duration._
class MyClass (val id: Int, val name: String) {}
class MyClass () {
var id: Int = 0
var name: String = ""
def MyClass(id: Int, name: String) {
this.name = name
this.id = id
}