Skip to content

Instantly share code, notes, and snippets.

View quesurifn's full-sized avatar
🎯
Focusing

Kyle Fahey quesurifn

🎯
Focusing
View GitHub Profile
// Port
interface NotificationService {
// rejects to errored state
sendEmail(to: string, body: IEmailBody): Promise<IEmailSuccess>
sendPush(deviceToken: string, body: IPushBody): Promise<IPushSuccess>
}
// Adapter
class TwilioService {
use std::collections::HashMap;
use std::io::{self, Read, Write};
use std::net::SocketAddr;
use mio::net::{TcpListener, TcpStream};
use mio::{Events, Interest, Poll, Token};
use crossbeam_channel::{unbounded, Sender, Receiver};
use std::thread;
use std::time::Duration;
const SERVER: Token = Token(0);
use std::collections::HashMap;
use std::io;
use std::io::{Read, Write};
use std::net::{SocketAddr};
use mio::{Events, Interest, Poll, Token};
use mio::event::Source;
use mio::net::{TcpListener, TcpStream};
/*
Checks for /r/n/r/n in a window of 4 bytes in the request header
@quesurifn
quesurifn / export-vscode-search-to-csv.js
Created April 1, 2024 14:54 — forked from jakebellacera/export-vscode-search-to-csv.js
Export VSCode search results to CSV
// How to use:
// 1. In VS Code, perform a search.
// 2. Click "Open in editor" to open the search results in a `.code-search` file
// 3. Save the file
// 4. In terminal, run `node export-vscode-search-to-csv.js path/to/results.code-search path/to/exported.csv`
const fs = require("fs");
const path = require("path");
const readline = require("readline");
@quesurifn
quesurifn / apollo_managed_federation.js
Created August 26, 2022 16:22
Apollo Managed Federation in Nest.js
@Module({
imports: [
GraphQLModule.forRootAsync<ApolloGatewayDriverConfig>({
driver: ApolloGatewayDriver,
useFactory: async () => ({
server: {
path: '/graphql',
cors: true
},
gateway: {
@quesurifn
quesurifn / gist:042af0e3c30967cd3acbf9e2eb8398c0
Last active August 20, 2022 17:40
M1 Mac Tensorflow Deps
wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh
chmod +x ~/Downloads/Miniforge3-MacOSX-arm64.sh
sh ~/Downloads/Miniforge3-MacOSX-arm64.sh
source ~/miniforge3/bin/activate
conda install -c apple tensorflow-deps
python -m pip install tensorflow-macos
python -m pip install tensorflow-metal
@quesurifn
quesurifn / race_detector.go
Created August 4, 2022 22:47
Race Detector
func main() {
start := time.Now()
var t *time.Timer
t = time.AfterFunc(randomDuration(), func() {
fmt.Println(time.Now().Sub(start))
t.Reset(randomDuration())
})
time.Sleep(5 * time.Second)
}
func main() {
// we need a webserver to get the pprof webserver
go func() {
log.Println(http.ListenAndServe("localhost:6060", nil))
}()
fmt.Println("hello world")
var wg sync.WaitGroup
wg.Add(1)
go leakyFunction(wg)
wg.Wait()
package demo
import "testing"
func TestConvertCelciusToF(t *testing.T) {
type args struct {
c float64
}
tests := []struct {
name string
package router
import (
"fmt"
"time"
)
func UpdateDatabaseAndElasticSearch(ctx context.Context, doc *Doctor) error {
// make channel for communication from Go routines
channel := make(chan error, 2)