This file contains hidden or 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
| { | |
| "QS104EW": { | |
| "source": "Office for National Statistics", | |
| "updated": "17/10/2013 16:51:00", | |
| "dimension": { | |
| "2011WARDH": { | |
| "category": { | |
| "index": { | |
| "K04000001": 0 | |
| }, |
This file contains hidden or 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
| #First we create an empty dict object | |
| data = {} | |
| #We need to specify the dataset name | |
| dataset = "QS104EW" | |
| # We get the actaul observation values from the JSON-STAT as a list | |
| values = obj[dataset]['value'] | |
| # Then we get the index of the observations and its asccociated categories as a dict |
This file contains hidden or 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
| {u'Females': 28502536, u'Males': 27573376, u'All categories: Sex': 56075912} |
This file contains hidden or 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
| #! /usr/bin/env python | |
| import json | |
| import requests | |
| def process(obj, ds): | |
| data = {} | |
| values = obj[ds]['value'] | |
| index = obj[ds]['dimension'][obj[ds]['dimension']['id'][1]]['category']['index'] | |
| labels = obj[ds]['dimension'][obj[ds]['dimension']['id'][1]]['category']['label'] |
This file contains hidden or 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
| # Using v0.1 copy from our GitHub repo | |
| install_github("rjstat", "ONSDigital") | |
| url <- "http://s3.sammachin.com/QS103EW.json" | |
| results <- fromJSONstat(readLines(url)) | |
| length(results$`Age by single year`$value) | |
| [1] 102 | |
This file contains hidden or 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
| ### Keybase proof | |
| I hereby claim: | |
| * I am sammachin on github. | |
| * I am sammachin (https://keybase.io/sammachin) on keybase. | |
| * I have a public key whose fingerprint is 4867 9F57 F2C9 7E38 62D2 5838 890C 49E3 52CD 329B | |
| To claim this, I am signing this object: |
This file contains hidden or 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
| <rule-set no-match-action="continue"> | |
| <rule target-port="5060" | |
| action="accept"/> | |
| </rule-set> | |
| <rule-set name="Block Incomming" | |
| source-interface="pppoe" | |
| target-interface="LAN" | |
| no-match-action="reject" | |
| comment="Default firewall rule - block incoming"> |
This file contains hidden or 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-external] | |
| // Send Notification | |
| exten => 01934xxxxxx,1,AGI(agi://192.168.1.11:4573/log?chan=landline&cli=${CALLERID(num)}) | |
| // Allow whitelisted numbers | |
| exten => 01934xxxxxx/07970xxxxxx,2,Dial(SIP/1000&SIP/1001&SIP/1002&SIP/2000) | |
| exten => 01934xxxxxx/01202xxxxxx,2,Dial(SIP/1000&SIP/1001&SIP/1002&SIP/2000) | |
This file contains hidden or 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 struct | |
| def convert(input): | |
| v1 = struct.pack('>I', int(input, 2)) | |
| v2 = struct.unpack('<I', v1) | |
| output = int(''.join(map(str,v2))) | |
| return output | |
This file contains hidden or 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
| my($input) = 0b01000000010000100000111100000000; | |
| my $v1 = pack("I>", $input); | |
| my $v2 = unpack("I<", $v1); | |
| print "$v2" | |