-
Use a set-based filesystem (instead of directory based). These would act like tags. Sets generated from predicates would also be handled by the filesystem (when used), for example
?modified>yesterday,?size<1M. These could also include file extensions.vlc media,?modified>yesterdayfor files in the set 'media' which were modified since yesterday, and
vim >>modified
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/sh | |
| du -hd 1 2> /dev/null | sort -h |
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
| #include <stdio.h> | |
| #include <stdint.h> | |
| #include <inttypes.h> | |
| /* Buffer is big-endian */ | |
| /* Get bits in order of descending significance */ | |
| uint8_t get_bit(const uint8_t *x, size_t n) | |
| { | |
| return (x[n / 8] & (1 << (7 - (n % 8)))) != 0; |
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/python3 | |
| from sys import argv | |
| with open(argv[1]) as f: | |
| lines = f.readlines() | |
| d = dict() | |
| for line in lines: | |
| if line[0] != '*' or 'color' not in line: | |
| continue |
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
| # Write to /etc/netctl/eduroam and start with netctl start eduroam | |
| # Replace <wireless device> <username> and <password> below | |
| Description='Eduroam' | |
| Interface=<wireless device> | |
| Connection=wireless | |
| Security=wpa-configsection | |
| IP=dhcp | |
| ESSID=eduroam | |
| WPAConfigSection=( |
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
| # Generate passwords which can be typed without using any finger to press two | |
| # different keys in a row. | |
| from math import log, ceil | |
| # For each finger, write the letters *you* type with that finger. | |
| finger_classes = [ | |
| 'qaz', | |
| 'wsx', | |
| 'edc', |
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
| def meme(f): | |
| memes = {} | |
| def inner(*args, **kwargs): | |
| key = (args, tuple(sorted(kwargs.items()))) | |
| if key in memes: | |
| return memes[key] | |
| ret = f(*args, **kwargs) | |
| memes[key] = ret | |
| return ret | |
| return inner |
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/sh | |
| # Example: | |
| # deadman /etc/network/interfaces 120 && service networking restart & | |
| # | |
| # After two minutes, changes are reverted and the service is restarted. | |
| # No getting locked out! | |
| # (you were root weren't you?) | |
| backup=`cat "$1"` |
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
| from itertools import product, permutations | |
| from pyaccum import accumulate | |
| class Proposition: | |
| def __invert__(self): | |
| return Impl(self, bottom) | |
| def __or__(self, other): | |
| return Disj(self, other) |
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
| from itertools import count | |
| class r_class: | |
| def __getitem__(self, items): | |
| for i, element in enumerate(items): | |
| if element is Ellipsis: | |
| if i >= 2: | |
| step = items[i - 1] - items[i - 2] | |
| elif i == 1 and items[0] > items[2]: | |
| step = -1 |