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 urllib3 | |
| import re | |
| import us | |
| import string | |
| import json | |
| http = urllib3.PoolManager() | |
| req = http.request('get', "http://icanhazip.com") | |
| ip = req.data[:-1] | |
| req = http.request('GET', 'http://api.ipinfodb.com/v3/ip-city/?key=APIKEY&ip=' + ip) |
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
| function BayesNet(vars) { | |
| this.variables = {}; | |
| this.numVars = Object.keys(this.variables).length; | |
| for (v in vars) { | |
| this.variables[v] = new BayesNode(vars[v]); | |
| this.variables[v].CPTorder = this.generateDomainRows(this.variables[v].parents); | |
| this.variables[v].fullCPT = {} | |
| for (var i = 0; i < this.variables[v].CPTorder.length; i++) { | |
| this.variables[v].fullCPT[this.variables[v].CPTorder[i]] = this.variables[v].CPT[i]; | |
| } |
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
| function BayesNet(vars) { | |
| this.variables = {}; | |
| this.numVars = Object.keys(this.variables).length; | |
| for (v in vars) { | |
| this.variables[v] = new BayesNode(vars[v]); | |
| this.variables[v].CPTorder = this.generateDomainRows(vars[v].parents); | |
| this.variables[v].fullCPT = {}; | |
| this.variables[v].blocks = false; | |
| } | |
| for (v in vars) { |
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
| This will make a single serving of an "Oatmeal in a Cup". Its taste and texture is similar to a muffin or a baked oatmeal dish. | |
| 1/2 cup of quick cook oatmeal | |
| 1/2 cup of milk | |
| 1 egg | |
| 1/3 apple, chopped | |
| 1/3 bannana | |
| a generous dash of cinnamon | |
| 1 teaspoon of honey |
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
| users | |
| primary key | |
| human/zombie/dead | |
| npc? | |
| admin? | |
| star timer | |
| name | |
| living area | |
| handle | |
| Facebook account |
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
| function safeCreateDir($dir, $exit = true) { | |
| if (!file_exists($dir)) { | |
| if (!mkdir($dir, 0700, true)) { | |
| $processUser = posix_getpwuid(posix_geteuid()); | |
| error_log($dir." ".implode($processUser)); | |
| if ($exit) { | |
| debugMail('failed to create dir: ' . $dir, true); | |
| } | |
| return false; | |
| } |
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
| class PlanDatesTest extends PHPUnit_Framework_TestCase | |
| { | |
| public function testDateDisplay() { | |
| $this->assertEquals(PlanDates::dateDisplay(1438198178), "July 29, 2015"); | |
| $this->assertEquals(PlanDates::dateDisplay("2015-03-7"), "March 7, 2015"); | |
| } | |
| public function testYearStart() { | |
| $this->getMock('Util', array("isGrad")); |
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
| augroup VimjectsAutogroup | |
| au BufNewFile,BufRead .vimjectrc* setlocal ft=vim | |
| au VimEnter call vimjects#source("") | |
| au VimEnter let g:kdsfjdfksdfjsfj = "hello" | |
| au BufReadPre call vimjects#source("") | |
| augroup end |
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
| showUnitString :: Unit -> String | |
| showUnitString Unit m u | |
| | (null posUnits) && (null negUnits) = ms | |
| | null posUnits = ms ++ " 1/" ++ (showall negUnits) | |
| | null negUnits = ms ++ (showall posUnits) | |
| | otherwise = ms ++ (showall negUnits) ++ "/" ++ (showall negUnits) | |
| where negUnits = Map.map (abs) (Map.filter (\ x -> x < 0.0) u) | |
| posUnits = Map.filter (\ x -> x > 0.0) u | |
| ms = show m |
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 qualified Data.Map as Map | |
| import qualified Data.Text as Text | |
| import qualified Data.List.Split as Split | |
| import Text.Regex.PCRE | |
| --Units represent | |
| --Adding and subtraction can only be done on the same unit | |
| --Multiplication combines units | |
| --Exponentiation mult/div units | |
| --Can only Ord things of the same unit | |
| type UnitMap = Map.Map String Double |
OlderNewer