Skip to content

Instantly share code, notes, and snippets.

View Myestery's full-sized avatar
💭
Making the internet better

Chiwetelu Johnpaul Chidera Myestery

💭
Making the internet better
View GitHub Profile
@Myestery
Myestery / sleep_async.rs
Created January 22, 2024 08:20
How to asynchronously run a command and pipe the output
use tokio::process::Command;
use tokio::io::{self, AsyncBufReadExt};
#[tokio::main]
async fn main() -> io::Result<()> {
let shell_command = "sleep 2 && echo \"how\" && sleep 10 && echo \"yes\"";
let mut child = Command::new("sh")
.arg("-c")
.arg(shell_command)
@Myestery
Myestery / crypto.go
Last active December 29, 2023 13:17
Golang AES 2 way encryption
package main
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"encoding/base64"
"encoding/json"
"flag"
"fmt"
@Myestery
Myestery / nth_most_rate_signature.py
Last active November 2, 2022 08:56
Get nth most rate signature
def nth_most_rate_signature(list,n):
# save all enteries to a map
# key is the signature
# value is the number of times it appears
map = {}
for i in list:
if i in map:
map[i] += 1
else:
map[i] = 1