I hereby claim:
- I am rjloura on github.
- I am rjloura (https://keybase.io/rjloura) on keybase.
- I have a public key whose fingerprint is 1C91 E340 FC48 C37C BCEE A2AE 997E 6BF0 FAEB CE04
To claim this, I am signing this object:
| var ipv4_to_long = function(dots) {return ((((((+dots[0])*256)+(+dots[1]))*256)+(+dots[2]))*256)+(+dots[3]);}; | |
| /* | |
| * For IPv6 the "calculation" is easier because the max of each halfword is 'ffff', but we cant be as accurate because | |
| * the value will usually be > Number.MAX_SAFE_INTEGER. So the function below will only give you the answer in SI notation. | |
| */ | |
| var ipv6_to_long = function(v6addr) {parseInt(addr.replace(/:/g, ''), 16);}; |
| # TODO: Make this work with compressed format | |
| def ipv6_to_decimal(addr): | |
| return (int(addr.replace(':', ''), 16)) |
| Using the JSONEncoder from: https://github.com/bradjasper/django-jsonfield/blob/master/jsonfield/encoder.py | |
| def get_context_data(self, **kwargs): | |
| ctx = super().get_context_data(**kwargs) | |
| tl = Model.objects.filter(year=self.kwargs['year']).values() | |
| ctx['jsonstring'] = json.dumps(tl, cls=JSONEncoder) | |
| return ctx | |
| Then in the template: | |
| var json_data = {{ jsonstring|safe }}; |
| #!/bin/bash | |
| # Will need to install 'libfaac0' | |
| # '-strict -2' to allow experimental | |
| # set '-preset veryslow' for better compression | |
| # set '-crf' lower to get better quality (default is 23, I think) | |
| ffmpeg -i input.avi -strict -2 -c:v libx264 -crf 19 -preset slow -c:a aac -b:a 192k -ac 2 out.mp4 |
I hereby claim:
To claim this, I am signing this object:
| -----BEGIN PGP SIGNED MESSAGE----- | |
| Hash: SHA256 | |
| = | |
| This message has been signed by keybase.io/rjloura. The signature can be | |
| verfified at https://keybase.io/verify. | |
| = | |
| Encryption can be easy these days, and Facebook is anything but private. | |
| Please contact me instead on these more secure services (in order of preference): |
| /* Straight copy from https://stackoverflow.com/questions/4340227/sort-mixed-alpha-numeric-array */ | |
| /* Note that the ^ in [^xyz] creates a negated character set, and does not match the beginning of the line. */ | |
| var reA = /[^a-zA-Z]/g; | |
| var reN = /[^0-9]/g; | |
| function sortAlphaNum(a,b) { | |
| var aA = a.replace(reA, ""); | |
| var bA = b.replace(reA, ""); | |
| if(aA === bA) { | |
| var aN = parseInt(a.replace(reN, ""), 10); |
| # Build cscope xref for Golang. Works well for "Find this C symbol", but not very well for definitions. | |
| # Assuming you're in the project Root: | |
| #Find the files | |
| find . -name '*.go' > cscope.files | |
| #Build the xref | |
| cscope -b -k |
| #!/usr/bin/bash -x | |
| # | |
| # Creating a COAL on VirtualBox. (Still WIP) | |
| # | |
| # This guide assumes you've run "make coal" in your sdc-headnode workspace, | |
| # and copied over the files below from the VMWARE directory to your VBDIR: | |
| # zpool.vmdk | |
| # 4gb.img | |
| # USB-Headnode.vmdk | |
| # |
My chromebook doesn't have a caps lock key, it has a "search" key. When running crouton xfce4 is unaware of this key in the keybaord mappings GUI. This is how I ended up mapping the search/capslock key to escape.
KeyPress event, serial 28, synthetic NO, window 0x2600001,
root 0xd3, subw 0x0, time 16308538, (449,411), root:(1043,703),
state 0x0, keycode 133 (keysym 0xff1b, Escape), same_screen YES,
XKeysymToKeycode returns keycode: 9
XLookupString gives 1 bytes: (1b)