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 requests, json, urllib.request, os.path | |
from jsonschema import validate | |
countValid = 0 | |
countInvalid = 0 | |
api_endpoint = 'https://cthdmps.azurewebsites.net/api/v0/search' | |
bearer_token = 'mytoken' | |
if not os.path.exists('maDMP-schema-1.1.json'): |
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 | |
/**** example usage **** | |
print SubSupText::replaceSubSupHtml("H<sub>2</sub>O") . PHP_EOL; //H₂O | |
print SubSupText::replaceSubSupHtml("42km<sup>2</sup>") . PHP_EOL; //42km² | |
print SubSupText::replaceSubSupHtml("2<sup>th</sup> chapter") . PHP_EOL; //2ᵗʰ chapter | |
*/ | |
class SubSupText{ | |
const superscriptMap = [ | |
'0' => '⁰', '1' => '¹', '2' => '²', '3' => '³', '4' => '⁴', '5' => '⁵', |
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
#!/bin/bash | |
namespace=mynamespace | |
pods=$(kubectl get po -n $namespace -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{end}') | |
for i in $(echo $pods | sed "s/\t/ /g") | |
do | |
case $i in *"$1"*) | |
kubectl logs -n $namespace $i --follow;; | |
esac | |
done |
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 urllib.request | |
import os.path | |
from shapely.geometry import shape, Point | |
# download countries.geojson if needed | |
if not os.path.exists('countries.geojson'): | |
urllib.request.urlretrieve("https://datahub.io/core/geo-countries/r/countries.geojson", "countries.geojson") | |
# load GeoJSON containing country polygons |
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
using System; | |
using System.IO; | |
using System.Text.Json; | |
using System.Text.Json.Nodes; | |
using System.Collections.Generic; | |
using System.Security.Cryptography; | |
using HeyRed.Mime; | |
if(Environment.GetCommandLineArgs().Length == 1){ | |
Console.WriteLine("Provide argument for directory"); |
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 htmlLinksToPlainText(string $html): string{ | |
$htmlDom = new \DOMDocument; | |
@$htmlDom->loadHTML('<?xml encoding="utf-8" ?>'.$html); | |
$links = $htmlDom->getElementsByTagName('a'); | |
foreach($links as $link){ | |
$linkHtml = $htmlDom->saveHTML($link); | |
$linkText = $link->nodeValue; |
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 socket | |
import sys | |
import time | |
import random | |
#docs: | |
# http://www.limitlessled.com/dev/ | |
host = '10.10.10.255' #broadcast ip for my subnet | |
port = 8899 |