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 | |
from typing import Optional | |
def send_get_request(url, params:Optional[dict]=None) -> requests.Response: | |
return requests.get(url, params=params) | |
def send_post_request(url, data_dict:dict) -> requests.Response: | |
return requests.post(url=url, json=data_dict) | |
GET_API_ENDPOINT = "https://jsonplaceholder.typicode.com/posts/1" | |
POST_API_ENDPOINT = "https://jsonplaceholder.typicode.com/posts" |
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
{ | |
"workbench.colorTheme": "GitHub Dark", | |
"terminal.integrated.persistentSessionScrollback": 100000, | |
"terminal.integrated.scrollback": 1000000, | |
"terminal.integrated.allowChords": false, | |
"files.trimTrailingWhitespace": true, | |
"window.zoomLevel": 2, | |
"gopls": {}, | |
"go.lintTool": "golangci-lint" | |
} |
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
# this script was tested to work with Hoedown 3.0.7. | |
from collections import defaultdict | |
import subprocess | |
import re | |
p = re.compile(r'^(<a href="#toc_[0-9]+">)(.+)(<\/a>\n)$') | |
# takes a bunch of html lines starting and ending with ul tags | |
# return a single html string starting and ending with div tags | |
def rewrite_toc(lines): |
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
<head> | |
<style> | |
/* CSS for wikipedia style table of contents */ | |
html { | |
font-family: sans-serif; | |
} | |
.toc { | |
display: table; |
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 | |
# License: Public domain (CC0) | |
# Isaac Turner 2016/12/05 | |
# 1f604 2022/02/11 | |
from __future__ import print_function | |
import difflib | |
import re |
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 | |
# License: Public domain (CC0) | |
# Isaac Turner 2016/12/05 | |
from __future__ import print_function | |
import difflib | |
import re |
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
# change these as needed | |
MAX_RAM_USAGE = 4 # GB | |
ELASTIC_BINARY_LOCATION = "/home/x/elasticsearch-7.16.3/bin/elasticsearch" | |
LOG_FILE = "./log.txt" | |
from multiprocessing import Process | |
import subprocess | |
import os | |
import requests | |
from time import sleep |
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 multiprocessing import Process | |
import os | |
import requests | |
from time import sleep | |
def f(name): | |
print('hello! RUNNIGN ELASTIC!', name) | |
os.system('ES_JAVA_OPTS="-Xms2g -Xmx2g" /home/x/elasticsearch-7.16.3/bin/elasticsearch') | |
def monitor(): |
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 ( | |
"fmt" | |
"io" | |
"log" | |
"os" | |
"time" | |
) | |
func main() { |
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
// Code to send push notifications. Most of the code is taken from https://github.com/sideshow/apns2/ | |
// I wrote this because I didn't want to use any 3rd party dependencies. | |
package main | |
import ( | |
"bytes" | |
"context" | |
"crypto/ecdsa" | |
"crypto/rand" |
NewerOlder