I hereby claim:
- I am hotsyk on github.
- I am hotsyk (https://keybase.io/hotsyk) on keybase.
- I have a public key whose fingerprint is C89F 6A44 3E9B E20B 1EA7 7763 4064 F790 B2A6 B2A6
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| # Elasticsearch Cheatsheet - an overview of commonly used Elasticsearch API commands | |
| # cat paths | |
| /_cat/allocation | |
| /_cat/shards | |
| /_cat/shards/{index} | |
| /_cat/master | |
| /_cat/nodes | |
| /_cat/indices | |
| /_cat/indices/{index} |
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(query_start, clock_timestamp()), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(query_start, clock_timestamp()), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| """ | |
| Script for automated analysis of profiling data in MongoDB, | |
| gathered by Mongo with db.setProfilingLevel(1). | |
| See <http://www.mongodb.org/display/DOCS/Database+Profiler> | |
| TODO: pass collection and database with profiling data in arguments | |
| TODO: make thread-safe | |
| """ | |
| from collections import defaultdict |
Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
| Ctrl+X | delete line |
| Ctrl+↩ | insert line after |
| Ctrl+⇧+↩ | insert line before |
| Ctrl+⇧+↑ | move line (or selection) up |
| try: | |
| import local_settings | |
| for param in dir(local_settings): | |
| if not '__' in param: | |
| setattr(sys.modules[__name__], param,\ | |
| getattr(local_settings, param)) | |
| except ImportError: | |
| pass |
| #!/bin/bash | |
| myfilename=$(date "+%Y-%m-%d_%H:%M") | |
| pg_dump -U dbuser -w dbname | gzip > /var/www/dbbackups/dbname-$myfilename.dump.gz | |
| /var/www/s3/s3-put -S -k <your-key> -s /var/www/dbbackups/secret.key -T /var/www/dbbackups/dbname-$myfilename.dump.gz /dbname-dbbackups/dbname/$myfilename-dbname.dump.gz | |
| ##you will need to get http://s3-bash.googlecode.com/files/s3-bash.0.02.tar.gz | |
| ##to ensure that secret file is 40 bytes, use | |
| ##echo -n your-secret-ket > secret.key |
| execve("/var/www/idhooks-root/env2/bin/pip", ["pip", "install", "-E", ".", "-r", "./releases/20100803183012/requir"...], [/* 24 vars */]) = 0 | |
| brk(0) = 0x85c6000 | |
| mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f84000 | |
| access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) | |
| open("/etc/ld.so.cache", O_RDONLY) = 3 | |
| fstat64(3, {st_mode=S_IFREG|0644, st_size=26370, ...}) = 0 | |
| mmap2(NULL, 26370, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7f7d000 | |
| close(3) = 0 | |
| open("/usr/lib/libpython2.5.so.1.0", O_RDONLY) = 3 | |
| read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\260\306\1\0004\0\0\0"..., 512) = 512 |
| """ | |
| This fabric file makes setting up and deploying a django application much | |
| easier, but it does make a few assumptions. Namely that you're using Git, | |
| Apache and mod_wsgi and your using Debian or Ubuntu. Also you should have | |
| Django installed on your local machine and SSH installed on both the local | |
| machine and any servers you want to deploy to. | |
| _note that I've used the name project_name throughout this example. Replace | |
| this with whatever your project is called._ |