This file contains 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 urllib.request | |
import re | |
import bs4 | |
def soup_url(url): | |
req = urllib.request.Request(url) | |
with urllib.request.urlopen(req) as resp: | |
return bs4.BeautifulSoup(resp.read(), 'html.parser') |
This file contains 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 | |
class Node implements JsonSerializable { | |
public function __construct( $name, $contents ) { | |
$this->name = $name; | |
$this->store = []; | |
foreach ( (array)$contents as $k => $v ) { | |
if ( is_int( $k ) ) { | |
$this->addChild( $v ); | |
} else { | |
$this->addAttribute( $k, $v ); |
This file contains 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
var assert = require( 'assert' ); | |
function findFrequentBigram( s ) { | |
var i, freqs = {}, topFreq = 0, topPair = null, bigram; | |
for ( i = 0; i < s.length; i += 2 ) { | |
bigram = s.slice( i, i + 2 ); | |
freq = ++freqs[bigram]; |
This file contains 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
// Generate a long URL (>5000 characters), request it twice, and check that: | |
// - the query param at the end of the URL was honored | |
// - the second resp was served from the cache | |
var https = require( 'https' ), | |
count = 0, | |
url = 'https://en.wikipedia.org/w/load.php?q='; | |
while ( url.length < 5000 ) { | |
url += Math.random().toString( 36 ).substring( 7 ); |
This file contains 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/python3 | |
""" | |
Get most commonly used Graphite functions in Grafana dashboards | |
Requires Python 3 | |
""" | |
import collections | |
import json | |
import re | |
import sqlite3 |
This file contains 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
--- a/cs1.lua | |
+++ b/cs1.lua | |
@@ -25,7 +25,7 @@ delare variables here that have page-wide scope | |
]] | |
-local Preview_mode = false; -- flag indicating that we are rendering a preview page (Show preview button) | |
+local is_preview_result = nil; -- flag indicating that we are rendering a preview page (Show preview button) | |
--[[--------------------------< F I R S T _ S E T >------------------------------------------------------------ |
This file contains 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
# -*- coding: utf-8 -*- | |
import sys | |
reload(sys) | |
sys.setdefaultencoding('utf-8') | |
import collections | |
import datetime | |
import operator | |
import itertools |
This file contains 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 | |
# -*- coding: utf-8 -*- | |
import contextlib | |
import json | |
import os | |
import re | |
import shutil | |
import subprocess | |
import sys | |
import urllib2 |
This file contains 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 | |
function globalInclude( $__phpFile ) { | |
$__retVal = include_once $__phpFile; | |
foreach ( get_defined_vars() as $name => &$value ) { | |
if ( $name !== '__phpFile' && $name !== '__retVal' ) { | |
$GLOBALS[ $name ] =& $value; | |
} | |
} | |
return $__retVal; | |
} |
This file contains 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
chunk_size used_chunks total_chunks mem_requested mem_wasted | |
88 0 11915 0 1048520 | |
96 8 10922 768 1047744 | |
104 2138 10082 218987 829541 | |
112 15348 18724 1700751 396337 | |
120 282277 288354 32666317 1936163 | |
128 13940 16384 1736633 360519 | |
136 9233 15420 1232754 864366 | |
144 17025 21843 2374793 770599 | |
152 18746 20694 2798468 347020 |