Skip to content

Instantly share code, notes, and snippets.

View sbeyer's full-sized avatar
🐐

Stephan Beyer sbeyer

🐐
View GitHub Profile
@sbeyer
sbeyer / lib.rs
Created May 16, 2021 23:00
For loop vs map in Rust
#![feature(test)]
extern crate test;
use std::net::*;
pub struct Foo {
a: u8,
b: u8,
c: u8,
@sbeyer
sbeyer / pdflatexmk
Last active September 25, 2020 16:01
Useful latexmk (which I call pdflatexmk)
#!/bin/sh
LATEXMK_CONFIG="\$pdf_previewer = 'start evince %O %S';"
latexmk -e "$LATEXMK_CONFIG" -pvc -pdflatex -interaction=nonstopmode -halt-on-error "$@"
@sbeyer
sbeyer / generate_a271205.py
Last active April 3, 2016 12:41
Generate-and-count code for OEIS A271205 using NetworkX
#!/usr/bin/env python3
import networkx as nx
def populate(table, n):
treelist = nx.generators.nonisomorphic_trees(n)
for tree in treelist:
degrees = list(nx.degree(tree).values())
if 2 not in degrees:
l = degrees.count(1)
@sbeyer
sbeyer / strohmandeln.md
Created January 10, 2016 13:33
Strohmandeln/Strohmanntarock-Regeln

Strohmandeln / Strohmanntarock

Disclaimer: Ich habe keine Ahnung von Stichkartenspielen und mal anhand verschiedener Quellen versucht, die Regeln von Strohmandeln herauszubekommen und hier einmal niederzuschreiben. Das ist bisher noch unvollständig und mit Sicherheit fehlerhaft. Ich bitte darum, zu ergänzen und zu korrigieren und dabei möglichst nicht auf andere Tarockspiele zu verweisen.

Etherpad: https://etherpad.net/p/strohmandeln.md

@sbeyer
sbeyer / find-code-in-comments.rb
Created October 10, 2015 23:44
Find commented out code in C/C++ files
#!/usr/bin/env ruby
# Tool that attempts to find commented out C++ code
#
# Basic strategy:
# - look for keywords (see CheckRE) in commented out code
# - ignore doxygen comment blocks
#
# Usage: find-code-in-comments.rb <files...>
#
# Author: Stephan Beyer
@sbeyer
sbeyer / make-include-graph.rb
Created October 6, 2015 22:34
Generating a graph (DOT format) from C/C++ includes
#!/usr/bin/env ruby
# Output a DOT file of the include structure of a project
#
# Usage:
# cd <the include path of the project>
# <path of this script>/make-include-graph.rb > includes.dot
require 'find'
def output_edges(path)
@sbeyer
sbeyer / clang-install-alternatives.sh
Created February 22, 2015 12:28
Install Debian alternatives for clang/llvm 3.7 stuff
#!/bin/sh
#
# Debian defaults clang/llvm to use 3.5 although 3.7 is available.
# For example, llvm-symbolizer is used by default, e.g.,
# if you use the address sanitizing feature of clang.
# The problem is that even if you use clang-3.7, it looks for
# llvm-symbolizer instead of llvm-symbolizer-3.7.
# A bug in packaging? Maybe. I don't know. I don't care.
# This simple script generates corresponding alternatives.
@sbeyer
sbeyer / mbox_send.py
Last active January 2, 2016 01:29 — forked from Turin86/mbox_send.py
A Python script that (re-)sends all messages in mbox files with From/To/Cc/Bcc as specified in the messages headers
#!/usr/bin/env python
"""\
A command-line utility that can (re)send all messages in an mbox file
with options for controlling the rate at which they are sent, etc.
"""
# This script is based on a gist on github, see
# https://gist.github.com/sbeyer/8230267
#
@sbeyer
sbeyer / rename-to-date.sh
Last active December 28, 2015 19:58
Shell script to rename files to YYYY-MM-DD/HHMMSS.EXT and if it already exists to YYYY-MM-DD/HHMMSS_1.EXT, YYYY-MM-DD/HHMMSS_2.EXT, YYYY-MM-DD/HHMMSS_3.EXT and so on
#!/bin/sh
# A script that renames files to
# YYYY-MM-DD/HHMMSS.EXT
# and if it already exists to:
# YYYY-MM-DD/HHMMSS_1.EXT
# YYYY-MM-DD/HHMMSS_2.EXT
# YYYY-MM-DD/HHMMSS_3.EXT
# and so on
#
# I need this often and always forget where I put it.