View day1.go
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
package main | |
import ( | |
"bufio" | |
"os" | |
"regexp" | |
"strconv" | |
"strings" | |
) |
View AsyncDisposableTransaction.test.ts
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 test, { describe } from 'node:test' | |
import { AsyncDisposableTransaction } from './AsyncDisposableTransaction' | |
import assert, { deepEqual, equal, rejects } from 'node:assert' | |
describe('AsyncDisposableTransaction', () => { | |
test('should rollback when not committed', async () => { | |
let rollbackCalled = false | |
await (async () => { | |
await using transaction = new AsyncDisposableTransaction() | |
transaction.rollback(() => { |
View gist:b4bb188515ad58d0255bace9ac476efc
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
esphome: | |
name: esphome-web-XXXXXX | |
friendly_name: XXXXX | |
esp8266: | |
board: esp01_1m | |
# Enable Home Assistant API | |
api: | |
encryption: |
View baking_jokes.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
[ | |
"Borrowing some flour", | |
"Waiting for the report to rise", | |
"Double checking the weights", | |
"Proofing the report", | |
"Was that one egg or two?", | |
"Toasting the oats", | |
"Loading the kneaded info", | |
"Reticulating splines", | |
"Mixing the customers and orders", |
View home-assistant-wifi-plug.yml
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
sensor: | |
- platform: cse7766 | |
current: | |
name: "current" | |
accuracy_decimals: 1 | |
voltage: | |
name: "voltage" | |
accuracy_decimals: 1 | |
power: | |
name: "power" |
View createComplexityPlugin.ts
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 { ComplexityEstimator, getComplexity } from 'graphql-query-complexity' | |
import { GraphQLError, GraphQLSchema, separateOperations } from 'graphql' | |
import { PluginDefinition } from 'apollo-server-core' | |
export const createComplexityPlugin = ({ | |
schema, | |
maximumComplexity, | |
estimators, | |
onComplete, | |
createError = (max, actual) => { throw new GraphQLError(`Query too complex. Value of ${actual} is over the maximum ${max}.`) }, |
View batchFetchExchange.ts
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
// Adapted from https://gist.github.com/jakubriedl/812c2a7b26927a2249a4719555d9a0ca | |
import DataLoader from 'dataloader' | |
import { Exchange, Operation } from 'urql' | |
import { pipe, map } from 'wonka' | |
interface BatchRequest { | |
url: RequestInfo | string | |
options?: RequestInit | |
} |
View hackerchat.rs
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
use std::{net::{SocketAddr, Ipv4Addr}, sync::Arc}; | |
use tokio::net::{UdpSocket}; //UdpFramed | |
use anyhow::{Context, Result}; | |
// use tokio::time::sleep; | |
// use std::time::Duration; | |
use socket2::{Socket, Domain, Type, Protocol}; | |
use serde::{Deserialize, Serialize}; | |
use std::time::{SystemTime, UNIX_EPOCH}; | |
use tokio::sync::mpsc::{self, Receiver, Sender}; | |
use futures::try_join; |
View cargo.toml
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
[package] | |
name = "hackerchat-rust" | |
version = "0.1.0" | |
edition = "2021" | |
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
[dependencies] | |
anyhow = "1.0.69" | |
async-channel = "1.8.0" |
View main.go
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
package main | |
import ( | |
"bufio" | |
"encoding/json" | |
"fmt" | |
"net" | |
"os" | |
"sync" | |
"time" |
NewerOlder