Skip to content

Instantly share code, notes, and snippets.

View CypherpunkSamurai's full-sized avatar
😶
Currently Busy 🌻🐢

Cypherpunk Samurai CypherpunkSamurai

😶
Currently Busy 🌻🐢
View GitHub Profile
@CypherpunkSamurai
CypherpunkSamurai / Fuck-Reddit.md
Created July 3, 2023 16:01
Make Reddit clients Alive again !!
View Fuck-Reddit.md

Make Reddit clients Alive again !!

Reddit has imposed paid API limits and that compelled developers to shutodwn their clients.
But There is a way you can Keep using your favourite reddit Client.

Obtaining Client ID

Step 1: Navigate to this page.

image

@CypherpunkSamurai
CypherpunkSamurai / readme.md
Last active May 30, 2023 03:30
Fonts for Programming?
View git_change_author_for_all_commit.md

git change author for all commit

change author from

git filter-branch -f --env-filter "GIT_AUTHOR_NAME='me' GIT_AUTHOR_EMAIL='me@gmail.com' GIT_COMMITTER_NAME='me_old' GIT_COMMITTER_EMAIL='me_old@gmail.com'" HEAD
@CypherpunkSamurai
CypherpunkSamurai / Readme.md
Last active February 21, 2023 15:23
Find Subclasses from a Python3 .py file without importing it
View Readme.md

Find Subclasses from a .py file without importing it using ast

We have .py file that has source code which includes inherited classes. We want to properly parse the file and determine the inherited classes are correct before we import the file.

How to approach the problem?

We have ast module in python which provides utility to parse the program as a tree and traverse through it. The ast.parse(source_code) returns a ast.Module object that is a tree of objects. We then traverse the tree to find ast.ClassDef objects that are classes. We then check for class.bases[] which is an array of superclass references for that class. We iterate though that to find ast.Attribute objects that are package attributes of the class package etc (unittest.Test here unittest is an attribute). We then find ast.Name object that contains the superclass name.

Using recursion (suggested)

@CypherpunkSamurai
CypherpunkSamurai / instructions.md
Created February 20, 2023 19:02
Decrypt a PDF in Windows
View instructions.md
@CypherpunkSamurai
CypherpunkSamurai / what_a_good_commit_message_looks_like.md
Created January 17, 2023 08:21 — forked from finalfantasia/what_a_good_commit_message_looks_like.md
What a good commit message looks like (Linus Torvalds)
View what_a_good_commit_message_looks_like.md

A good commit message looks like this:

Header line: explain the commit in one line (use the imperative)

Body of commit message is a few lines of text, explaining things
in more detail, possibly giving some background about the issue
being fixed, etc.

The body of the commit message can be several paragraphs, and

please do proper word-wrap and keep columns shorter than about

@CypherpunkSamurai
CypherpunkSamurai / opensuse.md
Last active January 12, 2023 11:02
Enable FireWall on Different Linux OS
View opensuse.md

OpenSUSE

# https://www.cyberciti.biz/faq/set-up-a-firewall-using-firewalld-on-opensuse-linux/

# If Not Installed
sudo zypper ref
sudo zypper update
sudo zypper install firewalld
sudo systemctl enable firewalld
View FINAL_hivemindtrainer.py
# Install bitsandbytes:
# `nvcc --version` to get CUDA version.
# `pip install -i https://test.pypi.org/simple/ bitsandbytes-cudaXXX` to install for current CUDA.
# Example Usage:
# Single GPU: torchrun --nproc_per_node=1 trainer/diffusers_trainer.py --model="CompVis/stable-diffusion-v1-4" --run_name="liminal" --dataset="liminal-dataset" --hf_token="hf_blablabla" --bucket_side_min=64 --use_8bit_adam=True --gradient_checkpointing=True --batch_size=1 --fp16=True --image_log_steps=250 --epochs=20 --resolution=768 --use_ema=True
# Multiple GPUs: torchrun --nproc_per_node=N trainer/diffusers_trainer.py --model="CompVis/stable-diffusion-v1-4" --run_name="liminal" --dataset="liminal-dataset" --hf_token="hf_blablabla" --bucket_side_min=64 --use_8bit_adam=True --gradient_checkpointing=True --batch_size=10 --fp16=True --image_log_steps=250 --epochs=20 --resolution=768 --use_ema=True
import argparse
import socket
import torch
@CypherpunkSamurai
CypherpunkSamurai / train.py
Created December 23, 2022 20:46 — forked from chavinlo/train.py
HIVEMIND_DISTRIBUTED_TRAINING_12_9_2022_8_37PM
View train.py
# Install bitsandbytes:
# `nvcc --version` to get CUDA version.
# `pip install -i https://test.pypi.org/simple/ bitsandbytes-cudaXXX` to install for current CUDA.
# Example Usage:
# Single GPU: torchrun --nproc_per_node=1 trainer/diffusers_trainer.py --model="CompVis/stable-diffusion-v1-4" --run_name="liminal" --dataset="liminal-dataset" --hf_token="hf_blablabla" --bucket_side_min=64 --use_8bit_adam=True --gradient_checkpointing=True --batch_size=1 --fp16=True --image_log_steps=250 --epochs=20 --resolution=768 --use_ema=True
# Multiple GPUs: torchrun --nproc_per_node=N trainer/diffusers_trainer.py --model="CompVis/stable-diffusion-v1-4" --run_name="liminal" --dataset="liminal-dataset" --hf_token="hf_blablabla" --bucket_side_min=64 --use_8bit_adam=True --gradient_checkpointing=True --batch_size=10 --fp16=True --image_log_steps=250 --epochs=20 --resolution=768 --use_ema=True
import argparse
import socket
import sys