Skip to content

Instantly share code, notes, and snippets.

View jaytaph's full-sized avatar
:shipit:
Calculating pi

Joshua Thijssen jaytaph

:shipit:
Calculating pi
View GitHub Profile
extern crate nom;
use nom::{
branch::alt,
bytes::complete::tag,
character::complete::{char, multispace0},
combinator::{map, recognize},
multi::separated_list1,
sequence::delimited,
IResult,
@jaytaph
jaytaph / gipc.rs
Last active January 22, 2024 09:47
ipc in rust
use fork::{fork, Fork};
use std::{process, thread};
use std::thread::sleep;
use anyhow::{anyhow, Error};
use ipc_channel::ipc::{IpcReceiver, IpcSelectionResult};
use ipc_channel::ipc::{self, IpcReceiverSet, IpcSender};
use serde::{Deserialize, Serialize};
use rand::Rng;
const MAX_PRIORITY: i8 = 127;
@jaytaph
jaytaph / gist:a1bd3d136093ce5628958c982da55f0e
Last active January 11, 2024 15:03
poc for implementation of polymorphic pseudonyms
use libpep::*;
use libpep::simple::*;
use rand_core::OsRng;
use std::{fmt::Write, num::ParseIntError};
use std::cell::RefCell;
use std::collections::HashMap;
use std::ops::Mul;
use std::rc::Rc;
pub fn decode_hex(s: &str) -> Result<Vec<u8>, ParseIntError> {
[Stylesheet (5)]
[AtRule] name: media
[MediaQueryList (2)]
[MediaQuery] modifier: only media_type: screen
[Condition (1)]
[Feature] kind: Media name: -webkit-min-device-pixel-ratio
[Number] 1.25
[MediaQuery] modifier: only media_type: screen
[Condition (1)]
[Feature] kind: Media name: min-resolution
@jaytaph
jaytaph / ChoiceTypeWithAttr.php
Last active May 14, 2023 10:47
Choice Type with help texts per option
<?php
namespace App\Form;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver;
class ChoiceTypeWithAttr extends ChoiceType
package middleware
func (*JWTToken) ServeHTTP(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
tmp := mux.Vars(r)
// tmp is nil
// Do stuff
next(w, r)
}
@jaytaph
jaytaph / AWS components.txt
Last active November 5, 2024 09:06
A list of AWS components and what they do.
Compute
EC2 Virtual Private Servers
Lightsail Amazon's hosting provider (vps, dns, storage)
Lambda Functions you can run, written in Python, NodeJS, Go etc. Can run many in parallel.
Batch Run software jobs on EC2 machines
Elastic Beanstalk Run software on managed virtual machines
Serverless Application Repository Repository of serverless applications that you can deploy (on lambda)
AWS Outposts Basically run Amazon services on your own hardware (datacenter)
EC2 Image Builder Create EC2 (ami?) images automatically
namespace KeyRotate;
use Doctrine\Common\Cache\PhpFileCache;
use Doctrine\DBAL\Driver\PDOMySql\Driver;
class PdoMysql extends Driver
{
protected $client;
protected $cache;
@jaytaph
jaytaph / joplin.jua
Created December 18, 2019 17:16
joplin.jua
hs.hotkey.bind({"cmd", "shift"}, "1", function()
local app = hs.application.get("Joplin")
if app == nil then
local app = hs.application.open("Joplin")
app:activate(true);
else
app:activate(true);
end
end)
<?php
namespace App\Services;
use Psr\Http\Message\RequestInterface;
use Zipkin\Propagation\RequestHeaders;
use Zipkin\Tracing;
class ZipkinGuzzleMiddleware {