This gist's comment stream is a collection of webdev apps for OS X. Feel free to add links to apps you like, just make sure you add some context to what it does — either from the creator's website or your own thoughts.
— Erik
object scala { | |
val version = "SCALA_VERSION$" | |
} | |
val xml = <dependencies> | |
<dependency> | |
<groupId>org.scalanlp</groupId> | |
<artifactId>scalala_${scala.version}</artifactId> | |
<version>0.3.1</version> | |
</dependency> |
import scala.util.continuations._ | |
class Generator[A] extends Iterator[A] with (A => Unit @ suspendable) { | |
private var a: Option[A] = None | |
private var k: Option[Unit => Unit] = None | |
def next = { | |
val a0 = a.get | |
val k0 = k.get | |
a = None |
#!/usr/bin/env python | |
# Usage: | |
# This script will generate two files(vpnup and vpndown) after executing. | |
# Do chmod a+x on the two newly created files, and then move them to the | |
# openvpn config folder. then add the following two lines to the vpn config file: | |
# up vpnup | |
# down vpndown | |
# you might also need 'redirect-gateway' in the config file, if you don't use vpn | |
# as the default gateway. |
package fx.jvm.hotspot.tools; | |
import java.util.List; | |
import sun.jvm.hotspot.tools.Tool; | |
public class PrintThreadIds extends Tool { | |
public static void main(String[] args) { | |
PrintThreadIds tool = new PrintThreadIds(); | |
tool.start(args); |
# Adapted from here: https://gist.github.com/489093 | |
# Original credit goes to pplante and copyright notice pasted below | |
# Copyright (c) 2010, Philip Plante of EndlessPaths.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 |
import java.io.BufferedReader; | |
import java.io.InputStream; | |
import java.io.InputStreamReader; | |
import java.io.IOException; | |
import java.lang.management.ManagementFactory; | |
import java.lang.management.RuntimeMXBean; | |
import com.sun.tools.attach.AttachNotSupportedException; | |
import com.sun.tools.attach.VirtualMachine; | |
import sun.tools.attach.HotSpotVirtualMachine; |
package org.nutz.lang.util; | |
import java.io.BufferedInputStream; | |
import java.io.DataInputStream; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.lang.reflect.Constructor; | |
import java.lang.reflect.Method; | |
import java.util.ArrayList; | |
import java.util.HashMap; |
import hashlib, zlib | |
HASH_BLOCKSIZE = 65536 | |
def filebaidumd5(f, size=262144): | |
h1 = hashlib.md5() | |
h2 = 0 | |
pos = 0 | |
buf = f.read(min(HASH_BLOCKSIZE, size)) | |
md5_at_size = None | |
while buf: | |
pos += len(buf) |
defmodule ROP do | |
defmacro try_catch(args, func) do | |
quote do | |
(fn -> | |
try do | |
unquote(args) |> unquote(func) | |
rescue | |
e -> {:error, e} | |
end |