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 / convolutional_autoencoder.ipynb
Created December 5, 2023 07:42
Keras Autoencoder Jupyter Notebook Tutorials
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@DiogenesAnalytics
DiogenesAnalytics / frenchdeck.py
Created December 6, 2023 17:43
Fluent Python Select Examples
import collections
Card = collections.namedtuple('Card', ['rank', 'suit'])
class FrenchDeck:
ranks = [str(n) for n in range(2, 11)] + list('JQKA')
suits = 'spades diamonds clubs hearts'.split()
@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