Skip to content

Instantly share code, notes, and snippets.

@salzig
salzig / app.cs
Last active May 12, 2019 15:05
Stupid Ring Linked List in C#
// Prints: (anker) C <- B <- A <- C <- B <- A
using System;
public class Program
{
public static void Main()
{
Ring ring = new Ring();
ring.prepend("B");
@salzig
salzig / notification
Last active March 28, 2018 12:05
Send OSX Notifications from Terminal or Script via Simple OSAScript
#!/usr/bin/osascript
# Place this Script in any of this `echo -e ${PATH//:/'\n'}` directories and make sure to `chmox +x notification`
# Usage:
# notification "Hello World"
# or
# notification Hello World
on run argv
set AppleScript's text item delimiters to space
#!/bin/bash
FIFO_FILE=factorio.fifo
PID_FILE=factorio.pid
if [ ! -p $FIFO_FILE ]; then
mkfifo $FIFO_FILE
fi
echo $$ > $PID_FILE
@salzig
salzig / config.ru
Created May 21, 2015 07:10
directory as itunes podcast experiment
#use Rack::Static, root: ''
feed = lambda { |env|
server = [env['SERVER_NAME'], env['SERVER_PORT']].compact.join(':')
# file = File.join(Dir.pwd,env['PATH_INFO'])
# if File.exist? file
# return [200, {'Content-Type'=>'video/quicktime', 'Content-Length'=>File.size(file).to_s}, [File.read(file)]]
# end
@salzig
salzig / selectionSort.erl
Created November 19, 2014 08:14
Was fehlt.....
%% aufruf um exemplarisch über "zahlen.dat" zu laufen
runSelectionSortExample() ->
StartTime = time(),
selectionSortOverFileLines("zahlen.dat").
%% Öffne Datei, und iteriere über die Tuple
selectionSortOverFileLines(Filename)
Tuples = file:consult(FileName),
selectionSortOverTuples(Tuples).
@salzig
salzig / Person.java
Last active August 29, 2015 14:01
Person Class
class Person {
private String name;
public Person(String name) {
this.name = name;
}
public Person() {
this("Keks");
}
input_size = 12
input_bandwith = 100
print "upload ",input_size," TB with ",input_bandwith,"mbit/s \n\n"
scale=1
kilo = 1024
mega = 1024 * kilo
giga = 1024 * mega
tera = 1024 * giga
@salzig
salzig / # gcc -v
Created April 20, 2014 21:20
mapcrafter debug - ENV for m0r13
# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.6/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
@salzig
salzig / ipaddr.rb
Created April 9, 2014 15:02
Monkey Patch Ruby's stdlib IPAddr with netmask method
require 'ipaddr'
class IPAddr
# netmask to the people!
def netmask
_to_string(@mask_addr)
end
end