Skip to content

Instantly share code, notes, and snippets.

@lu4nm3
lu4nm3 / main.rs
Last active May 6, 2024 12:00
Tokio Async: Concurrent vs Parallel
use futures::StreamExt;
use std::error::Error;
use tokio;
use tokio::macros::support::Pin;
use tokio::prelude::*;
use tokio::time::{Duration, Instant};
pub fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut multi_threaded_runtime = tokio::runtime::Builder::new()
.threaded_scheduler()
/* UTILS AND CONSTANTS*/
const SPEED_MULTIPLIER = 1.852;
const DISTANCE_MULTIPLIER = 111.045;
const SETTINGS = {
"default_object_online_timeout": 5
,"valid_by_avg_speed": false
,"min_moving_speed": 6
,"addon.device_tracker_app_login": false
@jforge
jforge / reset-pi-passwd.md
Created May 6, 2024 11:58 — forked from jlollis/reset-pi-passwd.md
Reset Forgotten Raspberry Password

Reset Forgotten Raspberry Pi Password

Remove SD Card

The first step is to turn off the Raspberry so you can remove the memory card without worry.

If the Raspberry Pi is not connected to a screen, the only way to turn it off is to unplug it. Otherwise, you can go through the GUI to turn it off properly, via the menu, before unplugging it.

Once the Raspberry Pi is turned off, you can insert the card into your computer and go to the next step.

@tuansoibk
tuansoibk / cryptography-file-formats.md
Last active May 6, 2024 11:56
Cryptography material conversion and verification commands
  1. Introduction
  2. Standards
  3. Common combinations
  4. Conversion
  5. Verification/Inspection
  6. Tips for recognising

Introduction

It happens that there are many standards for storing cryptography materials (key, certificate, ...) and it isn't always obvious to know which standard is used by just looking at file name extension or file content. There are bunch of questions on stackoverflow asking about how to convert from PEM to PKCS#8 or PKCS#12, while many tried to answer the questions, those answers may not help because the correct answer depends on the content inside the PEM file. That is, a PEM file can contain many different things, such as an X509 certificate, a PKCS#1 or PKCS#8 private key. The worst-case scenario is that someone just store a non-PEM content in "something.pem" file.

@iambryancs
iambryancs / get-argocd-default-password.md
Created October 3, 2023 03:05
Get ArgoCD default admin password

Get ArgoCD default admin password

To get ArgoCD default admin password after installation, run:

kubectl -n argocd get secret argocd-initial-admin-secret \
          -o jsonpath="{.data.password}" | base64 -d; echo

The default admin user is admin.

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@smontanaro
smontanaro / dusort.sh
Created November 7, 2022 11:01
I got this du postprocessing script from "the net" in the dark ages (probably from Usenet in the 80s or 90s). I have no idea who the original author was. I've never modified it **at all**. It has always just worked.
#!/bin/sh
#
# sort a "du" listing by directory size
# usage: du | dusort
FILES=
TFORM=0
while test $# -ge 1; do
case $1 in
-t) TFORM=1; ;;
@mjm918
mjm918 / client.py
Last active May 6, 2024 11:55
Python Encryption Decryption (Socket Chat,RSA Encryption/Decryption,AES.MODE_CTR encryption.IDEA.MODE_CTR Encryption/Decryption)
import time
import socket
import threading
import hashlib
import itertools
import sys
from Crypto import Random
from Crypto.PublicKey import RSA
from CryptoPlus.Cipher import IDEA
@rikukissa
rikukissa / POST.md
Last active May 6, 2024 11:52
React Hook prompting the user to "Add to homescreen" 🏠 #PWA #React
title slug createdAt language preview
React Hook prompting the user to "Add to homescreen"
react-hook-prompting-the-user-to-add
2018-11-29T20:35:02Z
en
Simple React Hook for showing the user a custom "Add to homescreen" prompt.

React Hook for showing custom "Add to homescreen" prompt

@kconner
kconner / macOS Internals.md
Last active May 6, 2024 11:47
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options: