Skip to content

Instantly share code, notes, and snippets.

View haraldschilly's full-sized avatar

Harald Schilly haraldschilly

View GitHub Profile
@haraldschilly
haraldschilly / shekel.m
Created October 24, 2012 12:53
Shekel Function
%Shekel-(4,5)
function y = sh5(x)
%
% Shekel function
% Matlab Code by A. Hedar (Nov. 23, 2005).
% The number of variables n = 4
% The parameter m should be adjusted m = 5,7,10.
% The default value of m = 10.
%
m = 5;
@haraldschilly
haraldschilly / countdown.py
Created November 25, 2012 19:49
Bitcoin Blockreward Estimation
#!/usr/bin/env python
# Copyright Harald Schilly <harald.schil.ly>
# License: Apache 2.0
# Hint: run it periodically via: watch -d -n 30 python countdown.py
# (sorry blockexplorer ...)
# which halfing? 1, 2, ...
nb_halfing = 2
quot = 2 ** nb_halfing
reward = 50. / quot
@haraldschilly
haraldschilly / mma9rpy2-2.png
Created November 30, 2012 15:41
R/Rpy2 Plotting along a Mathematica 9 Demo
mma9rpy2-2.png
@haraldschilly
haraldschilly / Complex.java
Last active December 17, 2015 03:09
.equals() mit hashCode() und JavaDoc in Java
/**
* Das ist eine Klasse für Komplexe Zahlen,
* welche die {@link Double} Klasse verwendet.
*
* <ul>
* <li>{@link Complex#add(complexnumbers.Complex) addiert komplexe zahlen}</li>
* </ul>
*
* @author Harald Schilly
*/
@haraldschilly
haraldschilly / DataStructures.java
Last active December 17, 2015 09:08
Demo Data Structures for Students & Exams
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class DataStructures {
static List<Student> studenten = new ArrayList<Student>();
@haraldschilly
haraldschilly / CustomExceptions.java
Created June 5, 2013 15:22
Custom Exceptions in Java
package customexceptions;
public class CustomExceptions {
public static void main(String[] args) throws NegativerWertException {
Rechner r = new Rechner();
try {
double wert1 = r.rechnung1(22.2);
System.out.println("wert1: " + wert1);
double wert2 = r.rechnung2(-5);
@haraldschilly
haraldschilly / Llabel.py
Created September 16, 2013 11:56
Llabel demo class for constructing class objects with different constructors and exporting them in different ways
#!/usr/bin/env python
# -*- coding: utf8 -*-
class Llabel(object):
"""
Lfunction Label
---------------
@haraldschilly
haraldschilly / Objektorientierung.java
Last active August 29, 2015 13:59
Vorlesung und Studierende als Einführungsbeispiel für OOP
package oop;
import java.util.Arrays;
/**
* Beispielprogramm zur Einführung in Objektorientiertes Programmieren (OOP)
*
* 2014-04-14
*
* @author Harald Schilly
@haraldschilly
haraldschilly / gist:66397f35919aed654976bf6e064a250c
Created October 6, 2017 09:05
vmlinux-4.10.0-35-generic / memmove
$ gdb -batch -ex 'file vmlinux-4.10.0-35-generic' -ex 'disassemble /r memmove' > /tmp/vmlinux-4.10.0-35-generic-memmove.txt
$ cat /tmp/vmlinux-4.10.0-35-generic-memmove.txt
Dump of assembler code for function memmove:
0xffffffff814585d0 <+0>: 48 89 f8 mov %rdi,%rax
0xffffffff814585d3 <+3>: 48 83 fa 20 cmp $0x20,%rdx
0xffffffff814585d7 <+7>: 0f 82 03 01 00 00 jb 0xffffffff814586e0 <memmove+272>
0xffffffff814585dd <+13>: 48 39 fe cmp %rdi,%rsi
0xffffffff814585e0 <+16>: 7d 0f jge 0xffffffff814585f1 <memmove+33>
0xffffffff814585e2 <+18>: 49 89 f0 mov %rsi,%r8
0xffffffff814585e5 <+21>: 49 01 d0 add %rdx,%r8