Skip to content

Instantly share code, notes, and snippets.

View mumairofficial's full-sized avatar
😎
Trying to invent useful tools

Muhammad Umair mumairofficial

😎
Trying to invent useful tools
  • Toronto, ON
View GitHub Profile
@mumairofficial
mumairofficial / README.md
Created April 10, 2024 01:59 — forked from noelbundick/README.md
Optimizing Rust container builds

Optimizing Rust container builds

I'm a Rust newbie, and one of the things that I've found frustrating is that the default docker build experience is extremely slow. As it downloads crates, then dependencies, then finally my app - I often get distracted, start doing something else, then come back several minutes later and forget what I was doing

Recently, I had the idea to make it a little better by combining multistage builds with some of the amazing features from BuildKit. Specifically, cache mounts, which let a build container cache directories for compilers & package managers. Here's a quick annotated before & after from a real app I encountered.

Before

This is a standard enough multistage Dockerfile. Nothing seemingly terrible or great here - just a normal build stage, and a smaller runtime stage.

Specification Keyword RGB hex value
CSS Level 1 black #000000
CSS Level 1 silver #c0c0c0
CSS Level 1 gray #808080
CSS Level 1 white #ffffff
CSS Level 1 maroon #800000
CSS Level 1 red #ff0000
CSS Level 1 purple #800080
CSS Level 1 fuchsia #ff00ff
CSS Level 1 green #008000
[
[
"2023-03-24T14:00:00Z",
"mel1",
0.00000780582
],
[
"2023-03-24T16:00:00Z",
"mel1",
0.548530874
@mumairofficial
mumairofficial / Java8DateTimeExamples.java
Created March 18, 2020 13:04 — forked from mscharhag/Java8DateTimeExamples.java
Examples for using the Java 8 Date and Time API (JSR 310)
import java.time.*;
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAdjusters;
import java.util.*;
import static java.time.temporal.TemporalAdjusters.*;
public class Java8DateTimeExamples {

What I Use

WIP: Personal blog & portfolio; will migrate this list once done!

Hardware

  • Dell 27" Monitor: P2719H
  • Dell Precision 7520
    • 2.90 GHz
    • 1TB SSD
    • 32GB Memory
  • Logitech MX Master 2 Mouse
@mumairofficial
mumairofficial / sublime-settings.json
Last active July 14, 2022 22:33
sublime text 3 settings
{
"auto_complete": true,
"auto_complete_commit_on_tab": true,
"auto_complete_with_fields": true,
"bold_folder_labels": true,
"color_scheme": "Packages/Agila Theme/Agila Classic Oceanic Next.tmTheme",
"default_encoding": "UTF-8",
"draw_minimap_border": true,
"draw_white_space": "all",
"folder_exclude_patterns":
@mumairofficial
mumairofficial / jwtRS256.sh
Created October 19, 2019 01:52 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@mumairofficial
mumairofficial / README.md
Created September 19, 2019 11:28 — forked from anhldbk/README.md
TLS client & server in NodeJS

1. Overview

This is an example of using module tls in NodeJS to create a client securely connecting to a TLS server.

It is a modified version from documentation about TLS, in which:

  • The server is a simple echo one. Clients connect to it, get the same thing back if they send anything to the server.
  • The server is a TLS-based server.
  • Clients somehow get the server's public key and use it to work securely with the server

2. Preparation

[user]
name = mumair
email = mumairofficial@gmail.com
[aliash]
gcmsg = commit -m
[alias]
# Git Commit, Add all and Push — in one step.
cap = "!f() { git commit -m \"$@\"; }; f" # git push; <- can add this as well | git add .;