Skip to content

Instantly share code, notes, and snippets.

@DiogenesAnalytics
DiogenesAnalytics / work-with-multiple-github-accounts.md
Last active November 26, 2023 23:10 — forked from rahularity/work-with-multiple-github-accounts.md
How To Work With Multiple Github Accounts on your PC

How To Work With Multiple Github Accounts on a single Machine

Let suppose I have two github accounts, https://github.com/rahul-office and https://github.com/rahul-personal. Now i want to setup my mac to easily talk to both the github accounts.

NOTE: This logic can be extended to more than two accounts also. :)

The setup can be done in 5 easy steps:

Steps:

  • Step 1 : Create SSH keys for all accounts
  • Step 2 : Add SSH keys to SSH Agent
@DiogenesAnalytics
DiogenesAnalytics / a_models_recall.py
Created November 24, 2023 10:25 — forked from RagingTiger/a_models_recall.py
Example Solution from Bnomial: A Model's Recall
"""
bnomial: 10/16/2023
A team built a binary classification model. They named the classes A and B.
After finishing training, they evaluated the model on a validation set, and
here is the confusion matrix with the results:
A B
┌────┬────┐
A│ 52 │ 7 │
@DiogenesAnalytics
DiogenesAnalytics / tianji_horse_race_problem.py
Created November 24, 2023 10:26 — forked from RagingTiger/tianji_horse_race_problem.py
Sun Bin's, the descendant of Sun Tzu, generalized solution for how General Tianji should race his horses against the King of Qi.
"""
References:
+ Shu, J. (2012). On Generalized Tian Ji's Horse Racing Strategy.
Interdisciplinary Science Reviews, 37, 187 - 193.
+ Leng, M., & Parlar, M. (2006). Game-theoretic analysis of an ancient Chinese
horse race problem. Comput. Oper. Res., 33, 2033-2055.
"""
def get_horses(n):
for horse in range(1, n+1):
@DiogenesAnalytics
DiogenesAnalytics / sample.py
Created November 24, 2023 10:26 — forked from RagingTiger/sample.py
Web Scraping using Bright Data Scraping Browser and Playwright
import re
import asyncio
from playwright.async_api import async_playwright
USERNAME = "TYPE YOUR USERNAME HERE"
PASSWORD = "TYPE YOUR PASSWORD HERE"
HOST = "zproxy.lum-superproxy.io:9222"
URL = "https://www.svpino.com/" # USE YOUR URL HERE
@DiogenesAnalytics
DiogenesAnalytics / all_pdf_dl.py
Created November 24, 2023 10:26 — forked from RagingTiger/all_pdf_dl.py
Download all pdf files from a website
import os
import requests
from urllib.parse import urljoin
from bs4 import BeautifulSoup
import argparse
#%% Example
# one pdf
# python all_pdf_dl.py -l https://memento.epfl.ch/academic-calendar/ --save-here
# many pdfs
@DiogenesAnalytics
DiogenesAnalytics / config-ubuntu.md
Last active June 7, 2024 19:27 — forked from RagingTiger/config-ubuntu.md
Setting up a new Ubuntu machine

About

A simple install script for setting up a fresh Ubuntu environment.

Usage

Download the script:

cd /tmp && \
curl -o config-ubuntu.sh https://gist.githubusercontent.com/RagingTiger/93c50d0d65ab5e81aba6188e58f7ca59/raw/config-ubuntu.sh || \
wget https://gist.githubusercontent.com/RagingTiger/93c50d0d65ab5e81aba6188e58f7ca59/raw/config-ubuntu.sh
@DiogenesAnalytics
DiogenesAnalytics / save_compress_split.sh
Created December 15, 2023 18:46 — forked from RagingTiger/save_compress_split.sh
Save a docker image into a compressed and multi-part file.
docker save $1 | gzip | split -b 1GB - img.gz.
@DiogenesAnalytics
DiogenesAnalytics / split_directory.sh
Created December 15, 2023 18:46 — forked from RagingTiger/split_directory.sh
Split a directory of 1000 files into 10 directories of 100 files.
for number in $(seq 1 10); do mkdir "Part_${number}" && mv "$(ls *.mp4 | head -n 100)" "Part_${number}"; done
@DiogenesAnalytics
DiogenesAnalytics / config_git_credentials.sh
Created December 15, 2023 18:46 — forked from RagingTiger/config_git_credentials.sh
Configure Git credentials for when using multipe GitHub accounts.
git_config_author(){
git config --local user.name "${1}"
git config --local user.email "${2}"
}
git_config_sshkey(){
# get ssh hosts
local ssh_hosts="$(grep "github.com-[a-Z]*" ~/.ssh/config | \
awk '{print $2}' | sed 's/github\.com-//g' | tr '\n' ' ')"
@DiogenesAnalytics
DiogenesAnalytics / art_of_war.txt
Created December 15, 2023 18:46 — forked from RagingTiger/art_of_war.txt
Various quotes from the Art of War by Sun Tzu
“Quickness is the essence of the war.” – Sun Tzu
“To know your Enemy, you must become your Enemy.” – Sun Tzu
“If your enemy is secure at all points, be prepared for him. If he is in superior strength, evade him. If your opponent is temperamental, seek to irritate him. Pretend to be weak, that he may grow arrogant. If he is taking his ease, give him no rest. If his forces are united, separate them. If sovereign and subject are in accord, put division between them. Attack him where he is unprepared, appear where you are not expected.” – Sun Tzu
“Strategy without tactics is the slowest route to victory. Tactics without strategy is the noise before defeat.” – Sun Tzu
“There are not more than five musical notes, yet the combinations of these five give rise to more melodies than can ever be heard.There are not more than five primary colors, yet in combination they produce more hues than can ever been seen.There are not more than five cardinal tastes, yet combinations of them yield more flavors t