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
""" | |
Computes the probability distribution of states created by | |
the shuffle2 algorithm. This should return results similar to | |
enumerate_shuffle.py. | |
A state is a 2-tuple: (swapped, deck) | |
The probability of transitioning from one state to another can be represented by | |
a Markov matrix M. |
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
// The following code has been tested. It compiles and works. | |
// Swift code | |
func encrypt(input: [UInt8]) -> Data? { | |
let key = SymmetricKey(size: .bits256) | |
let key64 = key.withUnsafeBytes { | |
return Data(Array($0)).base64EncodedString() | |
} | |
print("key64:", key64) | |
var sealedBox: AES.GCM.SealedBox |
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" |
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
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
# 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
#!/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
#!/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
<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
# 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): |
OlderNewer