Skip to content

Instantly share code, notes, and snippets.

View pvonmoradi's full-sized avatar

Pooya Moradi pvonmoradi

View GitHub Profile
@saulbaizman
saulbaizman / multiple github accounts, custom ssh hosts, and git url aliases.md
Last active October 3, 2024 21:12
multiple github accounts, custom ssh hosts, and git url aliases

multiple github accounts + custom ssh hosts + git url aliases

As is often the case, this is written for the search engines, because when I tried to find a solution to this problem, I couldn't find one. (Perhaps that was because I wasn't searching with the right keywords, or perhaps I would have found the solution had I been more persistent.) I also understand that very few people will encounter this "problem" (read: require, or desire, this crazy advanced configuration).

Because services like GitHub and BitBucket require each user account to have unique SSH keys, if you have multiple accounts on those services, it's necessary to generate multiple SSH keys.

First, we'll generate the keys.

$ ssh-keygen -t rsa -f github-user1 # key for user1
@reegnz
reegnz / README.md
Last active October 15, 2024 20:10
Implementing a jq REPL with fzf

Implementing a jq REPL with fzf

Update: I created jq-zsh-plugin that does this.

One of my favourite tools of my trade is jq. It essentially enables you to process json streams with the same power that sed, awk and grep provide you with for editing line-based formats (csv, tsv, etc.).

Another one of my favourite tools is fzf.

#!/usr/bin/env bash
# Get the command from arguments
arg_str="$*"
$arg_str &
pid="$!"
# Wait for the window to open and grab its window ID
winid=''
while : ; do
@code0100fun
code0100fun / 50-black-magic-blue-pill.rules
Created January 1, 2019 18:54
Udev rules for Black Magic Probe on an STM32 Blue Pill
# UDEV Rules for Black Magic Probe (STM32 Blue Pill)
# copy this file to /etc/udev/rules.d/50-black-magic-blue-pill.rules
# reload rules:
# $ sudo udevadm control --reload-rules && sudo udevadm trigger
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="6018", GROUP="plugdev", MODE="0666"
@bertrandmartel
bertrandmartel / nRF51_linux_intall.md
Last active August 3, 2024 16:38
nRF51 Development Kit complete setup for Linux
@willurd
willurd / web-servers.md
Last active November 13, 2024 13:44
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@nrk
nrk / command.txt
Created April 2, 2012 19:19
Using ffprobe to get info from a file in a nice JSON format
ffprobe -v quiet -print_format json -show_format -show_streams "lolwut.mp4" > "lolwut.mp4.json"
@cdown
cdown / gist:1163649
Last active September 25, 2024 14:24
Bash urlencode and urldecode
urlencode() {
# urlencode <string>
old_lc_collate=$LC_COLLATE
LC_COLLATE=C
local length="${#1}"
for (( i = 0; i < length; i++ )); do
local c="${1:$i:1}"
case $c in