Skip to content

Instantly share code, notes, and snippets.

View thamognya's full-sized avatar
🐧
Hello World, I am a dev.

Thamognya thamognya

🐧
Hello World, I am a dev.
View GitHub Profile
@thamognya
thamognya / split-pdf.py
Last active June 11, 2023 02:29
Split an pdf into N parts
import os
from PyPDF2 import PdfReader, PdfWriter
def split_pdf(input_file, output_folder, num_files):
os.makedirs(output_folder, exist_ok=True)
with open(input_file, 'rb') as file:
pdf = PdfReader(file)
total_pages = len(pdf.pages)
pages_per_file = total_pages // num_files
for i in range(num_files):
@thamognya
thamognya / python-good-practices.md
Created January 23, 2023 04:20
Python Good Practices

Python Good Practices

Here are a few good practices for writing Python code:

Follow the PEP 8 style guide for Python code. This guide provides guidelines for formatting and structuring code in a consistent and readable manner.

Use meaningful and descriptive variable names. Variable names should be clear and indicate the purpose of the variable. Avoid using single-letter variable names, unless they are used as temporary loop variables or for similar purposes.

Use snake_case for variable and function names, and use PascalCase for class names.
@thamognya
thamognya / how-to-pr.md
Created January 23, 2023 04:18
How to make PRs

How to Make PRs:

Here is a tutorial on how to make a pull request on GitHub using the command "git push origin main:BRANCH":

First, make sure you have git installed on your computer.

Clone the repository that you want to make a pull request to.

Create a new branch on your local machine by running the command "git branch BRANCH" (replace BRANCH with the name of the branch you want to create).
@thamognya
thamognya / branch-to-folder.sh
Created January 17, 2023 12:24
Convert git branches to folders
# https://stackoverflow.com/questions/63381853/any-way-to-turn-all-git-branches-into-folders-for-a-repository
#!/usr/bin/env bash
####
#
# $1 = Remote URL to be clonned
# $2 = New name of the repository
#
####
@thamognya
thamognya / bits-stdc++.h
Last active October 22, 2022 10:12
Source code of bits/stdc++.h
// C++ includes used for precompiling -*- C++ -*-
// Copyright (C) 2003-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
@thamognya
thamognya / kitty.conf
Created August 16, 2022 13:46
My Kitty Config
# vim:fileencoding=utf-8:foldmethod=marker
#: Fonts {{{
#: kitty has very powerful font management. You can configure
#: individual font faces and even specify special fonts for particular
#: characters.
font_family Fira Code
bold_font auto
@thamognya
thamognya / counter.html
Created July 4, 2022 06:07
A simple html + js counter
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>Counter</h1>
@thamognya
thamognya / vscode-settings.json
Last active December 30, 2022 15:57
vscode settings.json
{
"telemetry.telemetryLevel": "off",
"workbench.iconTheme": "material-icon-theme",
"editor.autoClosingBrackets": "always",
"editor.fontFamily": "'FiraCode Nerd Font Mono', 'Fira Code', 'Noto Mono', 'Droid Sans Mono', 'Courier New', monospace, 'Droid Sans Fallback'",
"editor.fontLigatures": true,
"editor.fontSize": 18,
"editor.cursorBlinking": "smooth",
"editor.cursorSmoothCaretAnimation": true,
"security.workspace.trust.untrustedFiles": "open",
@thamognya
thamognya / header.html
Created April 10, 2022 12:51
header.html for mirror.thamognya.com directory index apache
<head>
<!-- TITLE ATTRIBUTE -->
<title>Thamognya's Mirror Service</title>
<!-- MOBILE DEVICE SUPPORT -->
<meta name="viewport" content="width=device-width,initial-scale=1">
<!-- INLINE STYLE (NO MESS OF HIDING ADDITIONAL FILES IN .htaccess) -->
<style type="text/css">
/******************************
INLINE STYLES BEGIN HERE
*****************************/
@thamognya
thamognya / footer.html
Created April 10, 2022 12:45
footer.html for apache directory index footer