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> | |
<body> | |
<img src="foo"/> | |
<img src="bar"/> | |
</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
import heapq | |
class Heap(object): | |
def __init__(self, max=False): | |
self.max = max | |
self.data = [] | |
@property | |
def delta(self): | |
return -1 if self.max else 1 | |
def push(self, item): |
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
$ ls -1 font-repo/ | |
HelveticaNeue.ttf | |
LucidaGrande.ttc | |
meiryo.ttc | |
ヒラギノ丸ゴ ProN W4.ttc | |
ヒラギノ角ゴシック W8.ttc | |
$ python handmade-cjk.py | |
num desired: 23216 | |
num unsupported: 6640 | |
extras (supported by not desired): 6563 |
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
We get a lot of value from Django and Rest Framework, both of which are freely-licensed and volunteer-supported. I think it would be good to financially support the projects, at $X per year and $Y per month, respectively. | |
Details: | |
Django has a fellowship which funds a full-time developer to shepherd the contribution and release process. This has had a large impact on the project, making releases more reliable and widening the pool of contribution: https://www.djangoproject.com/weblog/2015/jan/21/django-fellowship-retrospective/ | |
Rest Framework is largely the work of a single core contributor, Tom Christie, who quit his job some time back in order to try to make DRF into financial break-even for himself. | |
Details on sponsorship for both projects are here: | |
https://www.djangoproject.com/fundraising/ |
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
mbp3:junk jdunck$ mkdir test | |
mbp3:junk jdunck$ cd test/ | |
mbp3:test jdunck$ git init | |
Initialized empty Git repository in /Users/jdunck/junk/test/.git/ | |
mbp3:test jdunck$ echo x > derp | |
mbp3:test jdunck$ git add derp | |
mbp3:test jdunck$ git commit -m "Initial" | |
[master (root-commit) 818e7a7] Initial | |
1 file changed, 1 insertion(+) | |
create mode 100644 derp |
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
select usename, nspname || '.' || relname as relation, | |
case relkind when 'r' then 'TABLE' when 'v' then 'VIEW' end as relation_type, | |
priv | |
from pg_class join pg_namespace on pg_namespace.oid = pg_class.relnamespace, | |
pg_user, | |
(values('SELECT', 1),('INSERT', 2),('UPDATE', 3),('DELETE', 4)) privs(priv, privorder) | |
where relkind in ('r', 'v') | |
and has_table_privilege(pg_user.usesysid, pg_class.oid, priv) | |
and not (nspname ~ '^pg_' or nspname = 'information_schema') | |
order by 2, 1, 3, privorder; |
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
# at bottom of settings.prod: | |
DATABASES = { | |
"source": local.OLD_DATABASES['default'], | |
"dest": local.NEW_DATABASES['default'] | |
} | |
DATABASES['default'] = DATABASES['dest'] |
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
delete from x where id < 1; | |
select sleep(.25); | |
delete from x where id < 50001; | |
select sleep(.25); | |
delete from x where id < 100001; |
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
In nginx.conf, in the Logging Settings section: | |
log_format replay '[$time_local] $server_name $status $content_type $request_method XX_HOST_XX$request_uri Authorization:"$http_authorization" $request_body_file'; | |
In specific server/location's config: | |
client_body_in_file_only on; | |
access_log /var/log/nginx/whatever-replay.log replay; |
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 psycopg2.extras import DictCursor | |
from django.db import connections | |
def get_cursor(alias='default', cursor_factory=None): | |
"""map from django's ORM layer to the raw DB cursor.""" | |
wrapped_conn = connections[alias] | |
# hack to ensure connection is immediately opened: | |
if wrapped_conn.connection is None: |
NewerOlder