temporenc v1:
100YYYYY YYYYYYYM MMMDDDDD
YYYYYYYY YYYYMMMM DDDDD111
| funcs: | |
| python setup.py build_ext --inplace | |
| test: funcs | |
| gcc -L. test.c -o test -lmyfuncs | |
| clean: | |
| rm -f test *.o *.so funcs.c |
temporenc v1:
100YYYYY YYYYYYYM MMMDDDDD
YYYYYYYY YYYYMMMM DDDDD111
| try: | |
| import sqlparse.format as sqlformat | |
| except ImportError: | |
| def sqlformat(query, **kwargs): | |
| """Monkey patch sqlparse.format if package not installed""" | |
| return query | |
| def debug_query(query, engine): | |
| """Return a parametrized and formated sql query for debugging |
| CREATE OR REPLACE FUNCTION jsonb_remove_keys( | |
| jdata JSONB, | |
| keys TEXT[] | |
| ) | |
| RETURNS JSONB AS $$ | |
| DECLARE | |
| result JSONB; | |
| len INT; | |
| target TEXT; |
mkdir /mnt/usb/.bup && bup init -r /mnt/usb/.bup to create and initialize a .bup directory on the USB disk. You may need to do some sudo and chmod/chgrp action depending on how your USB disk gets mounted. You'll save the actual files from backups here later.bup init to create the core bup repo in your home directory, the index will live herebup index ~/ to index your home directorybup index /etc to index your /etc directorybup save -n ${HOSTNAME}-etc -r /mnt/usb/.bup /etc to save the backup of your /etc directory to your USB disk. This backup set will result in a branch named after ${HOSTNAME}-etc, so that if you backup other PCs to this same .bup directory on your USB disk, you'll be able to see each one in a separate branch| # MOVED TO: https://github.com/meeuw/injectinput | |
| #!/usr/bin/python3 | |
| import evdev | |
| import sys | |
| upper = { '!': '1', '@': '2', '#': '3', '$': '4', '%': '5', '^': '6', '&': '7', '*': '8', '(': '9', ')': '0' } | |
| with evdev.UInput() as ui: | |
| escape = False |
| from inspect import isclass | |
| import __builtin__ | |
| # We're going to overwrite object, so we need to squirrel away the old one: | |
| obj = object | |
| # Metaclass, overriding the class' __getattribute__, | |
| # so that __qualname__ can be generated and cached on access: | |
| class QualnameMeta(type): |
| sudo apt-get install libsnappy-dev | |
| wget https://leveldb.googlecode.com/files/leveldb-1.9.0.tar.gz | |
| tar -xzf leveldb-1.9.0.tar.gz | |
| cd leveldb-1.9.0 | |
| make | |
| sudo mv libleveldb.* /usr/local/lib | |
| cd include | |
| sudo cp -R leveldb /usr/local/include |
| """ | |
| Example for creating classes with attrs that contain lazy-loaded fields. | |
| """ | |
| import attr | |
| _lazy_fields_container_name = "_lazy_fields" | |
| _lazy_field_metadata_key = "lazy" | |
| _lazy_loader_function_prefix = "lazy_loader__" |
This script uses the great message extraction library gettext-extractor by lukasgeiter.
The script assumes that the location of the source files is ./src. It parses both .js and .vue files. It writes the PO template file in ./i18n/messages.pot.
Some things to note:
{{}} (it is the most commmon case)..vue single file components are defined inline, and not referenced by a src attribue (it is the most common case).['$t', '[this].$t', 'i18n.t'].