View likstromsnat.hs
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
{- | |
| a dumb little circuit simulator in haskell | |
| by tangentstorm, 2012/08/22 | |
| | |
| This basically just calculates values using Ohm's law. | |
| it (probably?) only works for simple circuits where there | |
| is a single path from the power source to each node, and | |
| from each node back to the power source. | |
| | |
| many thanks to quicksilver and Axman6 on #haskell for advice |
View gist:3814556
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
""" | |
This program generates the following table: | |
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F | |
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F | |
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F | |
30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F | |
40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F | |
50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F | |
60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F |
View gist:3814598
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
""" | |
This program generates the following table: | |
01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F | |
It shows what happens when two generators share the same state. | |
Contrast with: https://gist.github.com/3814556 | |
""" |
View gist:4045219
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 | |
>>> data = ['2 (X-GM-THRID 1391221299548167514 X-GM-MSGID 1391221299548167514 UID 6)'] | |
>>> re.search('X-GM-THRID (?P<X_GM_THRID>\d+) X-GM-MSGID (?P<X_GM_MSGID>\d+)', data[0]).groupdict() | |
{'X_GM_THRID': '1391221299548167514', 'X_GM_MSGID': '1391221299548167514'} |
View refs.pas
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
{ freepascal reference experiment | |
-------------------------------------------------------- | |
Kaco_ / Phavel suggested the following problem | |
in #fpc on 11/15/2012: | |
layout2:tgui_layout; | |
layou1:=tgui_layout.init (..); | |
layout2:=layout1; |
View caseclass.pas
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
{$mode objfpc} | |
unit caseclass; | |
interface uses classes; | |
type | |
kinds = ( kINT, kSYM, kSTR, kREF, kNUL, kOBJ ); | |
RNode = record case kind : kinds of // valid pascal code | |
kINT : ( int : integer ); |
View gist:4224192
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
michal@proton:~/ver/fpc/compiler$ make clean cycle | |
/bin/sh: Syntax error: "(" unexpected | |
/bin/rm -f ppcross ppc ppc1.exe ppc2.exe ppc3.exe ./msg2inc.exe pp1.wpo pp2.wpo | |
/bin/rm -f ppc386.exe ppc68k.exe ppcx64.exe ppcppc.exe ppcsparc.exe ppcppc64.exe ppcarm.exe ppcmips.exe ppcmipsel.exe ppcjvm.exe ppc.exe ppcwpo1.exe ppcwpo2.exe | |
/bin/rm -rf units | |
/bin/rm -f *.o *.ppu *.rst *.s *.a *.so *.ppl | |
/bin/rm -rf *.sl | |
/bin/rm -f fpcmade.* Package.fpc ppas.sh script.res link.res | |
/bin/rm -f *_ppas.bat | |
make tempclean ppc3.exe |
View gist:4224472
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
$ cat system.pas | |
unit system; | |
interface | |
procedure test; | |
implementation | |
procedure test; | |
var t: longint; | |
begin | |
begin t:=1; end; |
View compiled code running in retro
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
Retro 11.5 | |
ok ( ---------------------------------- ) | |
ok ( runtime library ) | |
ok ( ---------------------------------- ) | |
ok : odd? mod 2 1 = ; | |
ok ( ---------------------------------- ) | |
ok ( generated code ) | |
ok ( ---------------------------------- ) | |
ok variables| i | |
View gist:4250692
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
michal@proton:~/vrx$ ./retro --with recurse.rx | |
Retro 11.5 | |
ok ( ---------------------------------- ) | |
ok ( runtime library ) | |
ok ( ---------------------------------- ) | |
ok : odd? mod 2 1 = ; | |
ok ( ---------------------------------- ) | |
ok ( generated code ) | |
ok ( ---------------------------------- ) |
OlderNewer