This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set terminal png size 1600,800 enhanced font "DejaVuSans,12" background rgb '#ff101010' | |
set output 'pingplot.png' | |
set title 'Svarstider (IPv4 ICMP Ping) till ping.sunet.se' textcolor rgb "#FF80C0FF" font "DejaVuSans-Bold,16" | |
set xdata time | |
set format x "%Y-%m-%d %H:%M:%S" | |
set rmargin at screen 0.85 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re, sys, time | |
t = re.compile(r'time=(.*?) ms') | |
line = True | |
while line: | |
line = sys.stdin.readline() | |
r = tuple(t.finditer(line)) | |
if len(r) == 1: | |
print(time.time(), r[0].group(1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import struct | |
def Align(data, size=4, padding=b'\x00'): | |
return data + ((size-(len(data) % size)) % size) * padding | |
def Aligned_split(data, char, size=4): | |
i = data.index(char) | |
i += ((size-(i % size)) % size) | |
return data[:i], data[i:] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ctypes | |
class rgba(ctypes.Structure): | |
_fields_ = ( | |
('r', ctypes.c_uint8), | |
('g', ctypes.c_uint8), | |
('b', ctypes.c_uint8), | |
('a', ctypes.c_uint8), | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class indented_line: | |
def __init__(self, line): | |
self.line = line.lstrip('\t') | |
self.tabs = len(line) - len(self.line) | |
def indent(self, indention): | |
return indented_line('\t'*(self.tabs + indention) + self.line) | |
@property | |
def stripped(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Include directives | |
#include <stdio.h> | |
#include <stdlib.h> | |
//Main application | |
int main(int argc, char* argv[]) { | |
printf("Hello World!\n"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
T = indented_block | |
program_template = T([ | |
'//Include directives', | |
'¶includes', | |
'', | |
'//Main application', | |
'¶main', | |
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class list_of_lines: | |
__slots__ = 'data', #Not necersary for this example but __slots__ is always | |
# nice to make the members a bit more strictly defined | |
def __new__(cls, text_or_instance): | |
#We use cls instead of self to make it clear that it is the class, | |
# not the new instance as you would with __init__ | |
#You could use __init__ together with __new__ of course but then you | |
# need to make sure the arguments of __init__ is compatible |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Inledande tester | |
-- Config | |
ender_chest_slot = 2 | |
bucket_slot = 1 | |
my_inventory = peripheral.wrap('right') -- Assumes we have a duck antenna equipped to the right | |
dofile('navigation.lua') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Some testing | |
# Run this script with python 3 | |
# Use the interactive mode, like: | |
# $ python3 -i gltest.py | |
# You need to have the glfw and of course GL runtimes | |
# Once you start the script you get a window | |
# You will also get the python interactive prompt in the terminal you started | |
# the script in | |
# Here you can adjust variables sx, sy, sr and s and directly observe the effect |
OlderNewer