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
from subprocess import call | |
# List of programs to install. | |
programs = [ | |
# "Essential" utilities: | |
"sudo", # the minimal install on Debian doesn't come with this | |
"vim", | |
"vim-gtk", # for gundo, which requires python | |
"python", | |
"python3", |
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
snippet hash "insert sha1 hash of the current file" | |
`!v strpart(system("sha1sum ".expand("%")), 0, 40)` | |
endsnippet |
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
# Fencepost loop using dictionaries. | |
def inters_dict(lst): | |
dct = {ch: True for ch in lst[0]} | |
for s in lst[1:]: | |
dct = {ch: True for ch in s if ch in dct} | |
return dct.keys() | |
# I suspect Pythonistas would find the use of (ch, True) as key-value | |
# pairs to be jarring, so here it is using sets---essentially, the | |
# "True" part is implied by virtue of being in the set. |
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
#!/bin/python3 | |
from math import floor, ceil | |
def max_subarray_brute_force(A): | |
''' | |
Given a list, return a tuple (low_index, high_index, max_sum), where | |
low_index and high_index give the starting and ending indices (both | |
inclusive) of the maximum subarray, and max_sum gives the sum of | |
that subarray. |
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
#!/bin/bash | |
while true; do | |
sleep $[($RANDOM % 10) * 100 + ($RANDOM % 10) * 10 + ($RANDOM % 10) + 1]s | |
scrot ~/Pictures/%Y-%m-%d_%T_scrot.png | |
done |
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
#!/usr/bin/python3 | |
# From http://stackoverflow.com/a/9169489 | |
c1 = (set(range(0x4E00, 0xA000)) | | |
set(range(0x3400, 0x4DC0)) | | |
set(range(0x20000, 0x2A6E0)) | | |
set(range(0x2A700, 0x2B740)) | | |
set(range(0x2B740, 0x2B820)) | | |
set(range(0xF900, 0xFB00)) | | |
set(range(0x2F800, 0x2FA20)) | |
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
[https://www.reddit.com/ Reddit] is an online discussion and content sharing site that has been called the "front page of the internet". Despite the impressive volume of information on Reddit, it's probably underused by young people as a source of intellectual content due to the site's difficult navigation, [[Wikipedia:Reddit#Controversies_involving_reddit|controversiality]], and general lack of awareness as a place to discover intellectual content. | |
In general the signal-to-noise ratio on Reddit is low (lower than on sites like [[Quora]] or LessWrong), but since many more people use Reddit than Quora or LessWrong, there is still possibly more total opportunities to discover interesting content or connect with smart people there. Moreover, developing the ability to [https://www.quora.com/What-are-the-most-underrated-life-skills/answer/Alex-K-Chen sort through low-quality content for good information] may prove useful. | |
On this page we describe some considerations on how to get the most out of Reddit. | |
==Gene |
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
<html> | |
<head><title>hello, world!</title></head> | |
<body> | |
<p>hello!</p> | |
</body> | |
</html> |
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 is free and unencumbered software released into the public | |
" domain. | |
" | |
" Anyone is free to copy, modify, publish, use, compile, sell, or | |
" distribute this software, either in source code form or as a compiled | |
" binary, for any purpose, commercial or non-commercial, and by any | |
" means. | |
" | |
" In jurisdictions that recognize copyright laws, the author or authors | |
" of this software dedicate any and all copyright interest in the |
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 = [1, 2] | |
>>> B = [3, 4] | |
>>> for i in A: | |
... for j in B: | |
... print((i,j)) | |
... | |
(1, 3) | |
(1, 4) | |
(2, 3) | |
(2, 4) |
OlderNewer