Python Linked List

Here is some list functions based on Martin v. Löwis’s representation: where w = sys.stdout.write Although doubly linked lists are famously used in Raymond Hettinger’s ordered set recipe, singly linked lists have no practical value in Python. I’ve never used a singly linked list in Python for any problem except educational. Thomas Watnedal suggested a … Read more

uint8_t vs unsigned char

It documents your intent – you will be storing small numbers, rather than a character. Also it looks nicer if you’re using other typedefs such as uint16_t or int32_t.

Squash my last X commits together using Git

Use git rebase -i <after-this-commit> and replace “pick” on the second and subsequent commits with “squash” or “fixup”, as described in the manual. In this example, <after-this-commit> is either the SHA1 hash or the relative location from the HEAD of the current branch from which commits are analyzed for the rebase command. For example, if … Read more

Reverse a string in Python

How about: This is extended slice syntax. It works by doing [begin:end:step] – by leaving begin and end off and specifying a step of -1, it reverses a string.