Skip to content

Instantly share code, notes, and snippets.

View parttimenerd's full-sized avatar

Johannes Bechberger parttimenerd

View GitHub Profile
@parttimenerd
parttimenerd / Main.java
Last active February 20, 2023 11:57
Tiny self-contained reproducer for https://bugs.openjdk.org/browse/JDK-8302320 (AsyncGetCallTrace obtains too few frames in sanity test)
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public class Main {
public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
Class<?> klass = Main.class;
Method mainMethod = klass.getMethod("test");
mainMethod.invoke(null);
}
@parttimenerd
parttimenerd / SmallProgram.java
Created December 27, 2022 12:55
JDWP transcript for blog post
public class SmallProgram {
public static void main(String[] args) {
String name = args[0];
System.out.println("Hello, " + name + "!");
}
}
@parttimenerd
parttimenerd / main.py
Created May 20, 2022 16:41
Note splitter
import json
import re
import sys
from dataclasses import dataclass, field
from pathlib import Path
from typing import List, Optional, Dict
COMMENT_SEP = "_____________"
@parttimenerd
parttimenerd / animals.hpp
Created March 19, 2019 14:00
Example code for my talk on object layouts in the C++ user group Karlsruhe (https://www.meetup.com/de-DE/C-User-Group-Karlsruhe/events/jphqdmyzgbnb/)
// by Andreas Fried
#include <cstring>
#include <iostream>
#include <string>
class Animal {
protected:
const std::string name;
@parttimenerd
parttimenerd / google_scholar_crawler.py
Last active May 29, 2017 11:44
Crawler to get a rough estimate on the academic articles in the field of microRNA research
"""
Copyright Johannes Bechberger (2017)
Licensed under the MIT license
Requirements:
- python3 (>= 3.4)
- requests
- matplotlib
- seaborn
- bs4
@parttimenerd
parttimenerd / Properly_align_LaTeX_images_to_baseline.py
Last active September 15, 2017 17:38 — forked from matshch/Properly_align_LaTeX_images_to_baseline.py
Add-on for Anki which properly align LaTeX images
# -*- coding: utf-8 -*-
# Properly align LaTeX images to baseline
#
# Improved by Johannes Bechberger
#
# Copyright (c) 2016, Artem Leshchev <[email protected]>
# 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
@parttimenerd
parttimenerd / index.html
Created March 28, 2015 21:49
Was hat zur Zeit Saison? // source http://jsbin.com/dinayeqefa
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0/handlebars.js"></script>
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment-with-locales.min.js"></script>
<meta charset="utf-8">
@parttimenerd
parttimenerd / intothewoods.md
Last active August 29, 2015 14:00
IntoTheWoods

This project aims to build a compiler for the (yet to be defined) programming language Oak in less than 10.000 lines of Java code. With a focus on simplicity and elegance - not on the performance of the produced assembly (or the pretty error messages).

##Notes on targets, etc. The intended targets are x86 (with stdclib support) and MIPS (MARS and SPIM dialect) assembler. For simplicity reasons, no values are kept in the registers except the ones that are required for each operation.

##Development notes The development is documentation driven (every feature of Oak should first by defined in this document) and semi test driven (every non trivial method of the Code should be tested via a JUnit test).

  • The error messages are not pretty and the parser can't recover from syntax errors (like an ANTLR generated one), but that's intended, as it keeps the code base and the level complexity small.
@parttimenerd
parttimenerd / berryengine.h
Created January 1, 2014 14:24
A text query based engine to sort a list of elements. Eventually used inside a Qt based project.
#ifndef BERRYENGINE_H
#define BERRYENGINE_H
#include <vector>
#include <QString>
#include <QMap>
#include <QHash>
#include <QSet>
#include <QRegExp>
#include <map>
#include <set>
@parttimenerd
parttimenerd / ideas.md
Last active December 30, 2015 20:29
Some cool ideas for even cooler projects...

##OrgaChat (done) A chat inspired by IRC, with it's backend written in [PHP or JavaScript] and a simple webfrontend. It will have an easy extendable back and frontend, build on IRC like commands.

I worked on this idea during christmas holidays: https://github.com/parttimenerd/orgachat.js

I actually wrote the chat entirely in JavaScript using node.js on the server side.

##CompilerInOrange (suspended) A compiler/assembler/vm for a language called OrangeLang, that compiles to some sort of MIPS assembler, which could be run in a vm or translated into MIMA or MARS style MIPS assembler.