This file contains hidden or 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
| : flash-size@ ( -- x ) | |
| dup | |
| [ | |
| $4900 h, \ ldr r1, [pc, #0] | |
| $e001 h, \ b.n | |
| $1ffff7e0 , \ .word 0x1ffff7e0 | |
| $8809 h, \ ldrh r1, [r1, #0] | |
| $028e h, \ lsls r6, r1, #10 | |
| ] | |
| ; |
This file contains hidden or 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
| : 2swap >R -rot R> -rot ; | |
| : test2swap 1 2 3 4 5 cr .s 2swap cr .s cr ; |
This file contains hidden or 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
| #!/bin/bash | |
| TARGET=mecrisp-stellaris-hackaday-edition.bin | |
| arm-none-eabi-objcopy -O elf32-littlearm -B arm --adjust-vma 0x8000000 --rename-section .data=.text -I binary $TARGET blob.o | |
| arm-none-eabi-gdb -b 115200 -ex 'target extended-remote /dev/ttyACM0' -ex 'set confirm off' -ex 'monitor swdp_scan' -ex 'attach 1' -ex 'set mem inaccessible-by-default off' -ex 'monitor erase_mass' -ex 'kill' -ex 'quit' | |
| arm-none-eabi-gdb -b 115200 -ex 'target extended-remote /dev/ttyACM0' -ex 'set confirm off' -ex 'monitor swdp_scan' -ex 'attach 1' -ex 'set mem inaccessible-by-default off' -ex 'load' -ex 'kill' -ex 'quit' blob.o | |
| #connect: folie-linux64 -r -p "/dev/ttyACM1" |
This file contains hidden or 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
| #! /bin/bash | |
| if [[ $BASH_SOURCE == $0 ]] ; then | |
| printf '?ERROR %s run it sourced ...\n' "$BASH_SOURCE" ; | |
| exit 1 ; | |
| fi | |
| echo -n "remove_from_history " | |
| if [ "$(type -t remove_from_history)" = 'function' ]; then | |
| echo "redefined " | |
| else |
This file contains hidden or 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 datetime | |
| import time | |
| import logging | |
| log = logging.getLogger(__name__) | |
| def log_performance(func): | |
| def wrapper(): | |
| datetime_now = datetime.datetime.now() | |
| # log.debug(f"Function {func.__name__} being called at {datetime_now}") |
This file contains hidden or 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
| #define MY_MAPPING(ENTRY) \ | |
| ENTRY(a, (0x10,0x01,0x01,0x00), foo) \ | |
| ENTRY(b, (0x10,0x01,0x02,0x00), boo) | |
| #define BRACIFY(...) { __VA_ARGS__ } | |
| #define MAKE_SOME_INT_ARRAY_THINGY(ID, INIT, X) int ID[] = BRACIFY INIT; | |
| MY_MAPPING(MAKE_SOME_INT_ARRAY_THINGY) |
This file contains hidden or 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
| GDB_C_INT = gdb.lookup_type("int") | |
| class Bpout (gdb.Breakpoint): | |
| def stop (self): | |
| pout = gdb.parse_and_eval ("port_out") | |
| mychar = chr(int(pout.cast(GDB_C_INT))) | |
| if mychar != '\0': | |
| sys.stdout.write(mychar) | |
| return False #Continue | |
| bpout = Bpout ("port_out", gdb.BP_WATCHPOINT, wp_class=gdb.WP_WRITE) |
This file contains hidden or 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
| #! /bin/bash | |
| if [[ $BASH_SOURCE == $0 ]] ; then | |
| printf '?ERROR %s: run it sourced ...\n' "$BASH_SOURCE" ; | |
| exit 1 ; | |
| fi | |
| echo -n "newdir " | |
| if [ "$(type -t newdir)" = 'function' ]; then | |
| echo "redefined " | |
| else |
This file contains hidden or 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 httplib, urllib | |
| sensor1_id = "XX" | |
| sensor2_id = "XX" | |
| sensebox_id = "XX" | |
| host = "ingress.opensensemap.org" | |
| url = '/boxes/%s/%s' % (sensebox_id, sensor2_id) |
This file contains hidden or 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
| mkfifo /tmp/board; | |
| wireshark -k -i /tmp/board & | |
| ssh root@10.7.6.5 "tcpdump -s 0 -U -n -w - -i lo not port 22" > /tmp/board; |