Skip to content

Instantly share code, notes, and snippets.

@P4
P4 / foreach.py
Last active December 14, 2015 17:59
Re-implement Python's for statement using @decorator syntax
#! /usr/bin/python
def foreach(iterable):
def iterate_over(func):
iterator = iter(iterable)
while True:
try:
value=next(iterator)
func(value)
@P4
P4 / .bashrc
Last active October 13, 2015 08:08
.bashrc: custom prompt, aliases
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
# Handy aliases
alias diff='~/bin/diff.py'
alias documents='cd /d/Dokumenty/'
@P4
P4 / main-template.c
Last active August 29, 2015 14:23
FreeRTOS
#include <stdio.h>
/* Scheduler includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
/* Library includes. */
#include "stm32f10x.h"
module tester (
//wejscia kontrolne
input clk,
input reset_n,
//interfejs do debugowania
output [1:0] dbg_state,
output [3:0] dbg_r0,
output [3:0] dbg_r1,
output [3:0] dbg_pc
@P4
P4 / Koch.asm
Last active August 29, 2015 14:02
Rysowanie krzywej Kocha: Generowanie przez LSystem, grafika żółwia
; Pawel Maniecki
; Asemblery, IET AGH
; Zadanie 3: Rysowanie krzywej Kocha
; Maksymalna liczba iteracji dla L-systemu: 6
; Maksymalna dlugosc odcinka: 100px
ITERMAX equ 6 ; Maksymalna ilosc iteracji ( nie wieksza od 6 )
; Dlugosc napisu opisujacego krzywa Kocha dla n iteracji dana jest wzorem
; K(n) = 7 * 4^n
@P4
P4 / RLE.asm
Last active August 29, 2015 14:01
Implementacja Run-Length-Encoding (RLE)
; Pawel Maniecki
; Asemblery, IET AGH
.186 ; pusha, popa
BUFSIZE = 4000h ; rozmiar bufora: 4*16*256 = 16*1024 = 16 KiB
_Dane segment
; Argumenty linii komend
argc db 0 ; ilosc argumentow ( dlugosc args )
; Pawel Maniecki
; Asemblery, IET AGH
.186 ; pusha, popa
_Dane segment
; Argumenty
argc db 0 ; ilosc argumentow ( dlugosc args )
args dw 10h dup(?) ; offsety na poczatki argumentow w argv