Skip to content

Instantly share code, notes, and snippets.

View Kagee's full-sized avatar
👾
Still working from home, what about you?

Anders Einar Hilden Kagee

👾
Still working from home, what about you?
View GitHub Profile
@Kagee
Kagee / core - Kagee
Created July 27, 2011 10:46
gdb-bt for core from weechat crash
(gdb) bt full
#0 0xf57fe416 in __kernel_vsyscall ()
No symbol table info available.
#1 0xb75f5941 in raise () from /lib/libc.so.6
No symbol table info available.
#2 0xb75f8e42 in abort () from /lib/libc.so.6
No symbol table info available.
#3 0x08093c0e in weechat_shutdown ()
No symbol table info available.
#4 0x080af7b0 in debug_sigsegv ()
Delivered-To: hildenae@gmail.com
Received: by 10.147.171.14 with SMTP id y14cs23041yao;
Wed, 14 Sep 2011 12:30:10 -0700 (PDT)
Received: by 10.204.149.72 with SMTP id s8mr133274bkv.126.1316028609440;
Wed, 14 Sep 2011 12:30:09 -0700 (PDT)
Return-Path: <fiksgatami@rt.nuug.no>
Received: from mail-ext1.uio.no (mail-ext1.uio.no. [129.240.10.51])
by mx.google.com with ESMTPS id b6si952319bke.38.2011.09.14.12.30.08
(version=TLSv1/SSLv3 cipher=OTHER);
Host github.com
User git
Hostname github.com
PreferredAuthentications publickey
IdentityFile /home/hildenae/.ssh/id_rsa_offle
import java.awt.BorderLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JToolBar;
public class ChlMiniprosjekt1 extends JFrame {
public ChlMiniprosjekt1(){
super("GridBagMaker");
hildenae@sektober:~/Dokumenter/Kildekode$ play
~ _ _
~ _ __ | | __ _ _ _| |
~ | '_ \| |/ _' | || |_|
~ | __/|_|\____|\__ (_)
~ |_| |__/
~
~ play! 1.2.3, http://www.playframework.org
~ framework ID is dev
~
%prod.db.url=jdbc:mysql://localhost/kopweb
%prod.db.driver=com.mysql.jdbc.Driver
%prod.db.user=user
%prod.db.pass=password
@Kagee
Kagee / dom.java
Created October 1, 2011 18:58
How to filter out invalid UTF-8 charaters
/*
The input documents somtimes has characters that are not valid as UTF-8 text. Where/how can i filter/remove them ?
[Fatal Error] week.html:191:320: An invalid XML character (Unicode: 0x19) was found in the element content of the document.
org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x19) was found in the element content of the document.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:249)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
at dom.main(dom.java:22)
*/
public class ReplacingInputStream extends FilterInputStream
public ReplacingInputStream(InputStream in) {
super(in);
this.in = in;
}
public int read() throws IOException {
int read = super.read();
if (read!=-1 && read<0x20 && !(read==0x9 || read==0xA || read==0xB))
{ read = 0x20;}
return read;
/*
1. The input documents somtimes has characters that are not valid as UTF-8 text. Where/how can i filter/remove them ?
hildenae@sektober:~/Dokumenter/Kildekode/statsparser$ java dom
com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence.
at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(UTF8Reader.java:684)
at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader.java:554)
at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1742)
at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.skipChar(XMLEntityScanner.java:1416)
@Kagee
Kagee / tweet.sh
Created November 2, 2011 16:10
cli-tweet - last-name-tweet + tweet_id
#!/bin/bash
# wget $? == 8 == server error response
if ! [[ "$1" =~ ^[0-9]+$ ]] ; then
# It's a string (user)
tweetXML=$(wget -q -O - "http://api.twitter.com/1/statuses/user_timeline/"$1".xml?trim_user=true&count=1&include_rts=true")
wgetRC=$?
if [ "$wgetRC" -eq "8" ]; then
echo "Brukeren finnes ikke"; exit 1;
fi