Skip to content

Instantly share code, notes, and snippets.

View Xosrov's full-sized avatar
🔍
Searching

Alireza Miryazdi Xosrov

🔍
Searching
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Xosrov
Xosrov / README.md
Created February 27, 2024 10:11
ssh passphrase remember
  1. Add to .ssh/config:
AddKeysToAgent yes
  1. Add to .bashrc:
# ssh-agent fix
if [ ! -S ~/.ssh/ssh_auth_sock ]; then
 eval `ssh-agent`
@Xosrov
Xosrov / cuda.md
Created November 6, 2023 07:19
Getting NVIDIA CUDA architecture and capability version with a Dockerfile
@Xosrov
Xosrov / MocksVsStubs.md
Last active May 18, 2023 08:06
Mocks Vs Stubs - GPT4/Claude+ to the rescue

Here's a good example of when using a mock (with testify/mock) has disadvantages compared to a stub:

Say you have an external API client in your code:

type API interface {
    GetUser(id int) (User, error)
}

func GetUser(api API, id int) (User, error) {
    return api.GetUser(id) 
@Xosrov
Xosrov / example.go
Created January 31, 2022 18:56
Pion WebRTC implementing NACK response
// Define codec and create local track
videoRTCPFeedback := []webrtc.RTCPFeedback{{"goog-remb", ""}, {"ccm", "fir"}, {"nack", ""}, {"nack", "pli"}}
codec := webrtc.RTPCodecParameters{
RTPCodecCapability: webrtc.RTPCodecCapability{webrtc.MimeTypeH264, 90000, 0, "level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f", videoRTCPFeedback},
PayloadType: 102,
}
vidTrack, err := webrtc.NewTrackLocalStaticRTP(codec.RTPCodecCapability, "video", "vid")
if err != nil {
panic(err)
}
@Xosrov
Xosrov / instructions.md
Last active April 25, 2025 17:41
Download .vsix extension files from Visual Studio Marketplace using python
  • Create extensions.txt file in script location and write list of extensions to get inside it. For example:
ms-toolsai.jupyter
ms-python.vscode-pylance
ms-vscode.cpptools
# and so on

This is the script:

@Xosrov
Xosrov / Compress images into PDF while removing exif data.md
Last active April 7, 2021 18:11
Compress images and create PDF from them, remove any existing EXIF data before and after pdf creation using multiple methods.
  • Create image scans using any method(this one is good)
  • Pass images to this script(tested on ubuntu)
  • Script requirements(tested with apt install on Ubuntu): exiftool imagemagick img2pdf ghostscript qpdf
#!/bin/bash
if [ $# -eq 0 ]
then
	echo "Input images to convert"
else
	for i in "$@"; do