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 re | |
| import pandas as pd | |
| import numpy as np | |
| # list of unique states | |
| stateStr = """ | |
| Ohio, Kentucky, American Samoa, Nevada, Wyoming | |
| ,National, Alabama, Maryland, Alaska, Utah | |
| ,Oregon, Montana, Illinois, Tennessee, District of Columbia | |
| ,Vermont, Idaho, Arkansas, Maine, Washington | |
| ,Hawaii, Wisconsin, Michigan, Indiana, New Jersey |
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
| def test_gdp(countries): | |
| """ | |
| Input: a series/ the Country column in GDP | |
| utf-8 encoded i.e. when reading GDP use | |
| encoding='utf-8' | |
| """ | |
| encodedC = '5,7,11,6,7,10,20,9,7,14,19,9,7,10,7,7,5,12,10,8,7,12,22,7,6,7,7,6,8,17,6,8,24,6,30,11,15,5,5,13,8,11,8,7,10,10,22,4,7,14,6,14,7,8,8,7,18,7,43,26,19,45,21,7,16,9,7,5,7,8,14,40,7,4,6,13,21,5,14,7,5,9,6,11,13,17,6,7,9,9,4,6,11,9,8,38,7,5,7,9,16,9,9,9,8,11,5,14,7,4,4,7,6,5,7,6,5,10,5,15,8,8,19,11,6,6,49,7,7,7,5,9,25,44,10,13,9,19,19,7,25,9,10,6,16,24,7,6,7,10,8,26,6,16,13,14,4,5,7,50,10,8,24,10,10,9,6,8,13,7,13,5,7,9,11,6,5,5,11,12,4,18,8,6,4,11,5,16,6,24,11,25,8,8,27,25,16,5,7,18,6,10,12,5,7,9,15,12,11,10,7,6,42,11,18,12,21,8,15,8,6,9,25,10,20,24,4,42,44,4,8,10,12,52,49,11,5,23,41,19,7,6,6,8,6,7,19,7,13,10,30,13,22,21,7,7,18,5,5,11,12,16,6,8' | |
| outcome = ['Failed\n', 'Passed\n'] | |
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
| def test_energy(countries): | |
| """ | |
| Input: a series/ the Country column in Energy | |
| utf-8 encoded i.e. when reading Energy use | |
| encoding='utf-8' | |
| """ | |
| encodedC = '11,7,7,14,7,6,8,19,9,7,5,9,7,10,7,7,10,8,7,7,6,5,7,6,7,32,22,8,6,22,17,8,12,7,10,8,8,6,14,24,4,5,5,9,42,8,7,5,12,10,13,7,4,7,6,14,37,32,7,8,8,18,7,5,11,17,7,7,8,14,16,4,7,6,13,16,5,6,7,7,5,9,6,9,7,10,4,9,8,6,13,6,5,8,7,7,5,9,4,4,7,11,6,5,7,5,6,6,10,5,8,6,10,32,6,7,7,7,5,13,9,10,10,6,8,8,4,5,16,10,10,9,6,10,8,10,10,7,10,7,7,5,5,11,13,11,9,5,7,4,24,6,4,8,5,6,16,8,4,11,6,8,11,5,11,19,7,7,18,6,12,21,11,25,32,5,21,12,7,6,10,12,9,12,8,8,15,7,12,11,5,9,18,5,8,9,6,11,20,10,8,41,11,4,5,19,7,6,12,24,6,6,7,20,14,27,13,28,7,10,7,9,8,25,5,6,8' | |
| outcome = ['Failed\n', 'Passed\n'] | |
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
| #!/bin/bash | |
| # | |
| # mh2mbox.sh | |
| # By Eric Lathrop <[email protected]> | |
| # | |
| # Convert MH mail folders to MBOX files | |
| # Useful for switching to Mozilla Thunderbird | |
| # | |
| # Copy this script to ~/Mail/ and execute. | |
| # |
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
| #!/bin/bash | |
| export PATH=/usr/bin:/bin:/usr/sbin:/sbin | |
| consoleUser() { | |
| python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "\n");' | |
| } | |
| displaydialog() { # $1: message | |
| message=${1:-"Message"} |
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
| { | |
| "@context": ["https://some.domain.com/caliper/ctx/v1p1", "http://purl.imsglobal.org/ctx/caliper/v1p1"], | |
| "id": "urn:uuid:956b4a02-8de0-4991-b8c5-b6eebb6b4cab", | |
| "type": "MediaEvent", | |
| "actor": { | |
| "id": "https://example.edu/users/554433", | |
| "type": "Person" | |
| }, | |
| "action": "Paused", | |
| "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
| <?php | |
| require_once 'CaliperTestCase.php'; | |
| use IMSGlobal\Caliper\actions\Action; | |
| use IMSGlobal\Caliper\context\Context; | |
| use IMSGlobal\Caliper\entities\agent\Organization; | |
| use IMSGlobal\Caliper\entities\agent\Person; | |
| use IMSGlobal\Caliper\entities\agent\SoftwareApplication; | |
| use IMSGlobal\Caliper\entities\lis\CourseSection; | |
| use IMSGlobal\Caliper\entities\lis\Membership; |
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
| def find(key, dictionary): | |
| for k, v in dictionary.items(): | |
| if k == key: | |
| yield v | |
| elif isinstance(v, dict): | |
| for result in find(key, v): | |
| yield result | |
| elif isinstance(v, list): | |
| for d in v: | |
| for result in find(key, d): |
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
| <?php | |
| // cURL obeys the RFCs as it should. Meaning that for a HTTP/1.1 backend if the POST size is above 1024 bytes | |
| // cURL sends a 'Expect: 100-continue' header. The server acknowledges and sends back the '100' status code. | |
| // cuRL then sends the request body. This is proper behaviour. Nginx supports this header. | |
| // This allows to work around servers that do not support that header. | |
| curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); | |
| // We're emptying the 'Expect' header, saying to the server: please accept the body right now. | |
| // Read here: http://pilif.github.com/2007/02/the-return-of-except-100-continue/ |
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
| /* -------------- FOR LINUX USERS ---------------- */ | |
| 1) Go to directory: "/usr/share/dbeaver" | |
| 2) Edit "dbeaver.ini" file | |
| 3) In that file add "-Duser.timezone=UTC" this line under "-vmargs" tag | |
| 4) Save it and restart dbeaver. | |
| 5) Enjoy with correct date without any date conversion. | |
| Finally your dbeaver.ini file will look like this: | |
| -startup |