Skip to content

Instantly share code, notes, and snippets.

@fahadsiddiqui
fahadsiddiqui / md-to-pdf.css
Created December 24, 2024 07:30
Custom CSS for https://md-to-pdf.fly.dev/ and a sample markdown.
@import url('https://fonts.googleapis.com/css2?family=Work+Sans:ital,wght@0,100..900;1,100..900&display=swap');
h1, h2 {
color: #F3B14E;
}
h3, h4, h5, h6 {
font-weight: 600;
color: #59C3CE;
}
@fahadsiddiqui
fahadsiddiqui / syscall_js_build_constraint.md
Created November 15, 2024 08:10
imports syscall/js: build constraints exclude all Go files in /usr/local/go/src/syscall

The syscall/js package has a build constraint.

Solution

Put this on top of the main file before package / wherever the syscall/js is imported

//go:build js && wasm
@fahadsiddiqui
fahadsiddiqui / go_private_pkgs_with_custom_ssh_keys.md
Created September 2, 2024 10:19
Go private package configuration with custom SSH keys.

Go private packages with different SSH config

Update your GOPRIVATE env

export GOPRIVATE=github.com/yourorg/yourrepo1,github.com/yourorg/yourrepo2

Check your SSH key HostName from .ssh/config and use it in ~/.gitconfig

@fahadsiddiqui
fahadsiddiqui / go_chan_wg.go
Created May 9, 2024 06:33
Go routines, channels and wait group demo.
package main
import (
"log"
"math/rand"
"sync"
"time"
)
type Report struct {
@fahadsiddiqui
fahadsiddiqui / find_string_in_certain_files.sh
Created February 20, 2024 14:44
Find/grep all occurrences of certain string in all the files ending with certain extension.
find . -type f -name "*.env" | xargs grep "HTTP_PORT"
@fahadsiddiqui
fahadsiddiqui / generate_gitignore_go.sh
Created November 27, 2023 05:36
Generate .gitignore file for a Golang based basic project.
#!/usr/bin/env bash
wget https://www.toptal.com/developers/gitignore/api/go -O .gitignore
@fahadsiddiqui
fahadsiddiqui / keybase.md
Created August 11, 2023 16:03
Keybase public identity.

Keybase proof

I hereby claim:

  • I am fahadsiddiqui on github.
  • I am fsdqui (https://keybase.io/fsdqui) on keybase.
  • I have a public key ASCL3APHaktYii4s1q9LPl5zfZmD2hhyGkTG2QevG2GatAo

To claim this, I am signing this object:

@fahadsiddiqui
fahadsiddiqui / install-hadoop-mac-apple-silicon.md
Last active September 20, 2024 15:40
Install Hadoop on Mac (M1, M2) with Apple Silicon
  • Install brew (Homebrew)
  • Install hadoop
    brew install hadoop
  • cd into hadoop configuration files
    cd /opt/homebrew/Cellar/hadoop/3.3.4/libexec/etc/hadoop
    
@fahadsiddiqui
fahadsiddiqui / docker_ps_pretty_print.md
Last active September 1, 2021 18:33
Program details docker handy commands.

Format out of Json using docker inspect

docker ps -q | xargs docker inspect --format '{{ .Id }} - {{ .Name }} - {{ .NetworkSettings.IPAddress }}'

Format docker ps

docker ps --format="{{.Names}}\t{{.ID}}\t{{.Ports}}"
#!/usr/bin/env bash
set -ex
PWD=$(pwd)
mkfifo /tmp/servicelogs.pipe || echo "pipe already exists"
runningPIDs=()
exitfn () {