This file contains hidden or 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 csv data | |
# date,2023-04-08,2023-04-09,2023-04-10,2023-04-11,2023-04-12,2023-04-13,2023-04-14,2023-04-15,2023-04-16,2023-04-17,2023-04-18,2023-04-19,2023-04-20,2023-04-21,2023-04-22,2023-04-23,2023-04-24,2023-04-25,2023-04-26,2023-04-27,2023-04-28,2023-04-29,2023-04-30,2023-05-01,2023-05-02,2023-05-03,2023-05-04,2023-05-05,2023-05-06,2023-05-07,2023-05-08,2023-05-09 | |
# 1min,120,120,125,130,130,135,140,145,145,145,146,147,150,152,155,155,156,157,158,158,158,157,158,158,158,158,158,158,160,160,160,161 | |
# 2min,120,120,125,125,126,130,130,132,133,134,135,140,145,150,150,150,152,152,148,148,149,145,150,151,147,145,147,150,151,151,152,153 | |
# 3min,120,120,122,123,125,127,130,131,132,133,135,136,140,140,142,143,144,145,144,145,146,140,146,146,140,135,145,146,146,146,147,148 | |
# 4min,110,120,115,112,120,122,123,125,124,125,126,127,130,133,135,133,135,130,130,131,132,120,133,130,120,120,135,135,136,136,137,139 | |
function(data, which) { | |
colors <- c("black","red","green","blue") |
This file contains hidden or 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.Collections.Generic; | |
using System.Reflection; | |
using System.Linq; | |
public class MyDictionary<T, V>: Dictionary<(string, T), V> | |
{ | |
private IEnumerable<(string Name, T Value)> GetMembers(object obj) | |
{ | |
var properties = obj.GetType().GetProperties(BindingFlags.Public).Select(o => (o.Name, Value: (T)o.GetValue(obj))); |
This file contains hidden or 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 typing import List, Iterator | |
from markdown_it import MarkdownIt | |
from markdown_it.token import Token | |
class Node: | |
token: Token|None | |
nodes: 'List[Node]' | |
def __init__(self, token: Token|None=None) -> None: | |
self.token=token |
This file contains hidden or 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 is a tokenizer, parser, and compiler that has been mostly generated by ChatGPT. | |
# A handful of errors have been corrected, as well as the addition of the ";" token | |
# and the ability to write multiple statements in a single line. This last part needed | |
# to be done by hand because ChatGPT lost the context of the BNF it created somewhere | |
# along the way, and was not able to regenerate a tokenizer/parser/compiler that | |
# worked with the original BNF. | |
# | |
# 94.42% of this code was created by ChatGPT (see differences.patch for more information). | |
# | |
# The conversation can be read here: |
This file contains hidden or 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
namespace aholmes.Writer | |
{ | |
/// <summary> | |
/// Wraps System.Console | |
/// </summary> | |
public class ConsoleWrapper : IConsole | |
{ | |
/// <inheritdoc/> | |
public void Write(string value) => Console.Write(value); | |
/// <inheritdoc/> |
This file contains hidden or 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 cProfile | |
from functools import wraps | |
from logging import Logger | |
from random import choice | |
from string import ascii_letters | |
from typing import TYPE_CHECKING | |
if TYPE_CHECKING: | |
from typing import Any, Callable |
This file contains hidden or 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
void Main() | |
{ | |
var file = @"path to file"; | |
var sw = new Stopwatch(); | |
sw.Start(); | |
var fileContent = File.ReadAllText(file); | |
sw.Stop(); | |
Console.WriteLine($"Time to read file: {sw.Elapsed.TotalMilliseconds}ms"); | |
const int iterations = 10000; |
This file contains hidden or 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 math import trunc | |
from struct import pack | |
from typing import List | |
from random import random | |
def main(): | |
# some hard-coded image attributes | |
# the width and height are 50 pixels | |
img_width = 50 |
This file contains hidden or 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 | |
import threading | |
from multiprocessing import Pool | |
from atexit import register | |
from sys import exit | |
from typing import Union | |
@register | |
def term(): | |
print("TERM!") |
NewerOlder