Skip to content

Instantly share code, notes, and snippets.

View piotrmaslanka's full-sized avatar

Piotr Maślanka piotrmaslanka

View GitHub Profile
@piotrmaslanka
piotrmaslanka / dataonly-mysql-dump.php
Created October 5, 2009 19:20
Data-only MySQL dumper
<?php
/**
* Essentially dumps data from given table, giving no clue as that the schema is
* Useful in conjunction with cron/wget database backups(my clients do that)
* Forces UTF-8 everywhere.
*
* @author Henrietta <piotr.maslanka@henrietta.com.pl>
* @license public domain
*/
/**
@piotrmaslanka
piotrmaslanka / elogreco.cob
Last active August 25, 2020 19:51
A function "plotter" in COBOL for z/OS mainframes.SYSIN should be a single record in form (for example)150 150 +1.000E-01 +0.000E-00where first two are maximum rows and columns of output dataset, and the rest are coefficients of a linear function that X is first passed thru (it normally goes from 1 to maxrows).Output dataset has name PLOTOUT. Re…
IDENTIFICATION DIVISION.
PROGRAM-ID ELOGRECO.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT FD-PLOTOUT ASSIGN PLOTOUT
ORGANIZATION IS SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD FD-PLOTOUT.
@piotrmaslanka
piotrmaslanka / pantadeuszd.py
Last active December 19, 2015 15:19
A network test daemon. Requires satella - https://github.com/henrietta/satella.
# coding=UTF-8
from __future__ import division
from satella.channels.sockets import Socket, ServerSocket, SelectHandlingLayer
import time, random
PACKS_AT_ONCE = (3, 4, 5, 6)
class Operator(SelectHandlingLayer):
def on_iteration(self):
for channel in self.channels:
@piotrmaslanka
piotrmaslanka / tukan.py
Created July 18, 2013 21:18
A simple tool to track CPU usage of given process
"""
A simple process to measure CPU usage of a process during specified time
Requires at least Linux 2.6.
Care with measurement on tickless kernels!
"""
from __future__ import division
import sys, time
if len(sys.argv) != 4:
@piotrmaslanka
piotrmaslanka / eunike-present.py
Created July 22, 2013 13:33
A sample service for eunike. Accepts messages via HTTP POST request. Provides statistical info upon GET requests.
# coding=UTF-8
from __future__ import division
import json, sys, os.path
import datetime
import sqlite3
import BaseHTTPServer, cgi
import time
import hashlib
PRESENTPATH = u'''<!DOCTYPE html>
@piotrmaslanka
piotrmaslanka / neutrony.cpp
Last active July 19, 2016 18:43
[MPI / SPRNG / OpenMP] A neutron transport Monte Carlo class project
#include <omp.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <mpi.h>
#include <string.h>
#define SPRNG_SIMPLE 1
#define SEED 985456376
@piotrmaslanka
piotrmaslanka / Alarm.c
Created June 13, 2014 01:05
[Atmel AVR] Software for my DIY home alarm controller. Superseded by a ladder-logic PLC solution. Contains a very nice UART/MODBUS library though.
#define F_CPU 1843200
#include "avr/interrupt.h"
#include "avr/wdt.h"
#include "pins.h"
#include "uart.h"
#define SIGNAL_LENGTH 4
#define ALARM_LENGTH 0x04EC
#define VB_ARMED 0x7F
@piotrmaslanka
piotrmaslanka / bfinterpreter.asm
Last active August 29, 2015 14:11
A Brainfuck CLI/Runtime in boot sector form
interpreter:
cmp dx, bp
jz cmdli
mov al, [ds:bp]
cmp al, '>'
jz incDP
cmp al, '<'
jz decDP
cmp al, '+'
@piotrmaslanka
piotrmaslanka / paprotka.pas
Created December 10, 2014 22:46
A multi-threaded big-BMP Barsley fern renderer.
program BarnsleyFullHD;
{$mode objfpc}{$H+}
uses
Classes; { for TThread }
type
TXY = object
X, Y: double;
procedure transform();
@piotrmaslanka
piotrmaslanka / CialaNiebieskie.py
Created December 10, 2014 22:48
A 2D solar system gravity modeler
from __future__ import division
from random import random
from Swiat import Swiat
import pygame
import math
def grawitacja(x,y,swiat):
if x.masa > 499999:
print 'Transport sighted: '+str(x.x)+ ' '+str(x.y)