Skip to content

Instantly share code, notes, and snippets.

View tbmreza's full-sized avatar
🎯
Focusing

Reza tbmreza

🎯
Focusing
View GitHub Profile
@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active November 18, 2024 19:17
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@ChrisWellsWood
ChrisWellsWood / empty_rust_structs.md
Last active November 8, 2024 11:54
Initialising empty structs in Rust.

Initialising Empty Structs in Rust

In C/C++, you can initialise a struct without giving values for any of the fields:

struct Point {
  float x;
  float y;
  float z;
};
@martinthenext
martinthenext / read_csv_to_dicts.py
Created July 31, 2018 19:40
Read CSV to dicts
def read_csv_to_dicts(filename):
with open(filename) as csvfile:
reader = csv.reader(csvfile, dialect='excel')
header = transform_header(next(reader))
if len(header) != len(set(header)):
raise ValueError("Duplicate column names in CSV.")
data = [{field: value for field, value in zip(header, row)}
for row in reader]