Skip to content

Instantly share code, notes, and snippets.

View mlc's full-sized avatar

mike castleman mlc

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mlc
mlc / gist:3920469
Created October 19, 2012 20:20
Adding to the calendar on Android
Intent calendarIntent = new Intent(Intent.ACTION_EDIT)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.setType("vnd.android.cursor.item/event")
.putExtra("beginTime", state.time)
.putExtra("endTime", state.endTime)
.putExtra("title", name)
.putExtra("description", calendarDescription)
.putExtra("eventLocation", address);
startActivity(calendarIntent);

How to buy a German postage stamp online

The Chaos Communication Congress is all-remote again this year, and there's another [sticker exchange][] happening! In order to participate, you need to mail a stamped envelope to the Sticker Operation Center, who will put some stickers in it and mail it back to you.

There's only one tricky bit: the stamp needs of course to be a German postage stamp, and these can be hard to come by if you're not in Germany. Fortunately, you can buy a stamp online and print it out from anywhere in the world! The site is only in German, though, so here's what you need to do if you don't read German.

Procedure

  1. Go to the [German Post Office's online postage page][internetmarke]. Interact with the cookies popup as you see fit.
@mlc
mlc / 0README.md
Last active November 3, 2018 06:50
#vomitlipo wordlist

#vomitlipo wordlist

For NaNoLiPo 2018, the November 5 challenge involves noting the "place of articulation" of the sounds of each word in your text. If this is not familiar, you may want a list of valid words.

This word list is based on the CMU Pronouncing Dictionary.

Then, a small javascript program transforms the ARPABET pronunciations contained therein into IPA, considers the "place of articularlation" of each consonant, and decides if the word is compliant with the #vomlitlipo constraint.

@mlc
mlc / mongers.txt
Created June 17, 2018 23:45
so many mongers
$ grep 'monger$' /usr/share/dict/american-english-huge
balladmonger
boroughmonger
carpetmonger
cheesemonger
costardmonger
costermonger
fancymonger
fashionmonger
fellmonger
@mlc
mlc / OkHttpOAuthConsumer.java
Created June 10, 2014 21:40
okhttp 2.0 + oauth signpost. extremely preliminary and not guaranteed.
import com.squareup.okhttp.Request;
import oauth.signpost.AbstractOAuthConsumer;
import oauth.signpost.http.HttpRequest;
public class OkHttpOAuthConsumer extends AbstractOAuthConsumer {
public OkHttpOAuthConsumer(String consumerKey, String consumerSecret) {
super(consumerKey, consumerSecret);
}
@Override
package com.meetup.adapter;
import android.database.Cursor;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
public class CursorPagerAdapter<F extends Fragment> extends FragmentStatePagerAdapter {
private final Class<F> fragmentClass;
#!/usr/bin/env ruby
#
# Utility to count the number of lines added to a git repository by month and file extension.
#
require 'csv'
require 'set'
stats = {}
val fifthGlyphs = charArrayOf(
'\u0065', '\u00D8' + 16, '\u00D9' + 16, '\u00DA' + 16, '\u00DB' + 16, '\u0113', '\u0117', '\u0119', '\u025B', '\u01DD',
'\u0045', '\u00C8', '\u00C9', '\u00CA', '\u00CB', '\u0112', '\u0116', '\u0118', '\u018D' + 1, '\u0190')
fun main(args: Array<String>) {
val concat = args.joinToString()
var msg : String = "your string isn't containing any nasty fifth glyphs"
if (concat.any { ch -> fifthGlyphs.contains(ch) })
msg = "oh no! a bad symbol!"