Skip to content

Instantly share code, notes, and snippets.

View oc's full-sized avatar

Ole Christian Rynning oc

  • UPPERCASE
  • Oslo, Norway
View GitHub Profile
tweets = []
Dir['search*'].each do |f|
File.open(f).readlines.join.scan(/(<li class="hentry status .*?<\/li>)/m).each do |tweet|
author = tweet[0].scan(/;">(.*?)<\/a>.*?<span id="msgtxt/m)[0].to_s
text = tweet[0].scan(/<span id="msgtxt\d+" class="msgtxt \w+">(.*?)<\/span>/m)[0].to_s.gsub(/<.*?>/, '')
tweets << [author, text]
end
end
puts tweets.uniq.sort.size
@oc
oc / Main.java
Created September 16, 2010 17:14
package no.muda.jetty;
import org.constretto.ConstrettoBuilder;
import org.constretto.ConstrettoConfiguration;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.HandlerList;
import org.eclipse.jetty.webapp.WebAppContext;
import org.springframework.core.io.DefaultResourceLoader;
import java.io.IOException;
@oc
oc / MANIFEST.MF
Created October 18, 2010 16:36
blog post
Manifest-Version: 1.0
Created-By: oc
Main-Class: example.database.Main
Liquibase-Package: liquibase.change,liquibase.database,liquibase.parser,liquibase.precondition,liquibase.serializer,liquibase.sqlgenerator,liquibase.executor,liquibase.snapshot,liquibase.logging,liquibase.ext
~/noko:➔ java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04-307-10M3261)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03-307, mixed mode)
~/noko:➔ rvm use jruby
Using /Users/oc/.rvm/gems/jruby-1.5.6
~/noko:➔ gem install nokogiri
Successfully installed weakling-0.0.4-java
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6353f18f, pid=2928, tid=1072
#
# JRE version: 6.0_23-b05
# Java VM: Java HotSpot(TM) Client VM (19.0-b09 mixed mode, sharing windows-x86 )
# Problematic frame:
# C [libxml2.dll+0x3f18f]
#
@oc
oc / Gemfile
Created January 10, 2011 16:04
source :rubygems
# .. dine andre gemmer
gem "ffi", '~> 1.0.0'
@oc
oc / maven-assembly-plugin.xml
Created January 14, 2011 12:09
Plugin-definition for maven-shade-plugin
<project>
...
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
@oc
oc / Trace
Created February 24, 2011 20:34
Rackup file
PROJECTNAME git:(master) ✗:➜ rake war
(in /Users/oc/dev/CUST/PROJECTNAME)
Building war...
rm -f PROJECTNAME-0.2.war
Creating PROJECTNAME-0.2.war
PROJECTNAME git:(master) ✗:➜ java -jar PROJECTNAME-0.2.war
[Winstone 2011/02/24 21:30:44] - Beginning extraction from war file
[Winstone 2011/02/24 21:30:45] - WARNING: The Servlet 2.4/2.5 spec XSD was unavailable inside the winstone classpath. Will be retrieved from the web if required (slow)
[Winstone 2011/02/24 21:30:45] - No webapp classes folder found - /private/var/folders/j5/j5DB04hkHXmebvTa5YmD-E+++TM/-Tmp-/winstone8064226446103174725webroot/PROJECTNAME-0.2.war/WEB-INF/classes
[webapp 2011/02/24 21:30:54] - unable to create shared application instance
package bekkopen.servlet;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@oc
oc / rc-avi2ipad.sh
Created April 29, 2011 21:29
Source this
FFMPEG=/opt/ffmpeg/bin/ffmpeg
function avi2ipad() {
for file in $*; do
title=$(basename ${file} .avi)
outfile=${title}.mp4
timestamp=$(date "+%Y-%m-%d %H:%M:%S")
if [[ -f ${file} ]]; then
echo "[${timestamp}] Converting ${file} to ${outfile}"