I hereby claim:
- I am mattlong on github.
- I am mateolargo (https://keybase.io/mateolargo) on keybase.
- I have a public key whose fingerprint is 2630 B827 4976 C128 FD90 8C08 0E97 4319 70DF A0F3
To claim this, I am signing this object:
| -- all connections | |
| select pid, datname, usename, left(application_name, 15) as app_name, state, backend_start, xact_start, query_start, state_change, wait_event_type, wait_event, left(regexp_replace(query,E'[\\n\\r]+',' ','g'), 40) from pg_stat_activity WHERE pid<>pg_backend_pid() ORDER BY datname, usename; | |
| -- active connections | |
| SELECT application_name, state, age(now(), xact_start) age, query FROM pg_stat_activity WHERE state <> 'idle'; | |
| SELECT application_name, pid, state, age(now(), xact_start) age, | |
| left(regexp_replace(query,E'[\\n\\r]+',' ','g'), 100) | |
| FROM pg_stat_activity WHERE state <> 'idle' ORDER BY age; | |
| from __future__ import print_function | |
| from sqlalchemy import ( | |
| Column, | |
| create_engine, | |
| MetaData, | |
| ) | |
| from sqlalchemy.types import String, Integer | |
| from sqlalchemy.dialects.postgresql import UUID | |
| from sqlalchemy.orm import sessionmaker | |
| from sqlalchemy.ext.declarative import declarative_base |
| # From http://stackoverflow.com/questions/17901588/new-repo-with-copied-history-of-only-currently-tracked-files | |
| Delete everything and restore what you want | |
| Rather than delete this-list-of-files one at a time, do the almost-opposite, delete everything and just restore the files you want to keep: | |
| $ git checkout master | |
| $ git ls-files > keep-these.txt | |
| $ git filter-branch --force --index-filter \ | |
| "git rm --ignore-unmatch --cached -qr . ; \ |
| """ | |
| SQLAlchemy, PostgreSQL (psycopg2), and autocommit | |
| See blog post: http://oddbird.net/2014/06/14/sqlalchemy-postgres-autocommit/ | |
| """ | |
| from contextlib import contextmanager | |
| from sqlalchemy import create_engine, event | |
| from sqlalchemy.orm import sessionmaker, Session as BaseSession |
| Remove osxfuse if installed via homebrew: | |
| > brew uninstall osxfuse | |
| Install osxfuse binary and choose to install the MacFUSE compatibility layer: | |
| http://sourceforge.net/projects/osxfuse/files/latest/download?source=files | |
| Reboot (optional but recommended by osxfuse) | |
| Install ntfs-3g via homebrew: | |
| > brew update && brew install ntfs-3g |
| #!/bin/bash | |
| cat << End-of-message | |
| ..........,...,.......,. .......,....,.................... | |
| ..MMMMMM..MM....M..,MNMMMM...MM...MM.......MM..MMMMMMMM... | |
| ..MM......MM....M..MM....MI..MM..MM. ......MM.....MM..,.. | |
| ..MMMMZ...MM....M..MM.. ...MMMMM.........MM.....MN... | |
| ..MM......MM. ..M..MM.. .....MM..MM........MM.....MN... | |
| ..MM:.....OM....Z..MM....MI..MM...MM.......MM.....MN... | |
| ..MM... ..,MM8......MMMMM...MM....MM......MM.....MN. |
I hereby claim:
To claim this, I am signing this object:
| def foldRight[A,B](l: List[A], z: B)(f: (A, B) => B): B = | |
| l match { | |
| case Nil => z | |
| case Cons(a, as) => f(a, foldRight(as, z)(f)) | |
| } | |
| def foldLeft[A,B](l: List[A], z: B)(f: (B, A) => B): B = | |
| foldRight(l, (b:B) => b)((a,g) => b => g(f(b,a)))(z) | |
| from functools import update_wrapper | |
| from django.contrib import admin | |
| from django.contrib.admin import ModelAdmin | |
| from django.contrib.admin.templatetags.admin_urls import add_preserved_filters | |
| from django.core.exceptions import PermissionDenied | |
| from django.shortcuts import render | |
| from myapp.models import Widget | |
| from myapp.forms import ManageWidgetForm |
| #!/bin/sh | |
| # | |
| # An example hook script to verify what is about to be committed. | |
| # Called by "git commit" with no arguments. The hook should | |
| # exit with non-zero status after issuing an appropriate message if | |
| # it wants to stop the commit. | |
| # | |
| # Usage: | |
| # Remove the .sh file extension when you put the script in your hooks folder! | |
| # |