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 React, { useState, useEffect } from 'react'; | |
import './AnalogClock.css'; | |
function AnalogClock() { | |
const [time, setTime] = useState(new Date()); | |
useEffect(() => { | |
const intervalID = setInterval(() => { | |
setTime(new Date()); | |
}, 1000); |
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
curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.23.0/minikube-darwin-amd64 \ | |
&& chmod +x minikube && \ | |
sudo mv minikube /usr/local/bin/ |
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
kubectl run kubia --image=luksa/kubia --port=8080 --generator=run/v1 |
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 json | |
import csv | |
# REPLACE THIS with json input | |
#input = '{"Parent": "Roy", "Children": [{"Name": "Todd"}, {"Name": "Shirley"}]}' | |
f = open("my.json", "r") | |
contents = f.read() | |
obj = json.loads(contents) |
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
getCIK = function(ticker) { | |
stopifnot(is.character(ticker)) | |
uri = "http://www.sec.gov/cgi-bin/browse-edgar" | |
response = getForm(uri,CIK=ticker,action="getcompany") | |
html = htmlParse(response) | |
CIKNode = getNodeSet(html, "//acronym[@title=\"Central Index Key\"][text() = \"CIK\"]") | |
CIKNodeText = sapply(CIKNode, function(x) xmlValue(getSibling(getSibling(x)))) | |
CIK = sub(" .*","",CIKNodeText) | |
CIK = sub("^0*","",CIK) |
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 os | |
basename = os.path.basename(path) | |
(root, extension) = os.path.splitext(basename) |
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 re | |
text = '''Information to be included in statements filed | |
pursuant to Rule 13d-1 (b) (c) and (d) and Amendments thereto | |
filed pursuant to Rule 13d-2 (b).''' | |
text = text.replace('(', '\(') | |
text = text.replace(')', '\)') | |
text = re.sub(r'\s+', '\s+', text) | |
text = re.sub(r'\.', '\.', text) |
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
from scrapy.shell import inspect_response | |
inspect_response(response, self) |
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
reload(sys) | |
sys.setdefaultencoding('utf8') |
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
reload(sys) | |
sys.setdefaultencoding('utf8') |
NewerOlder