Skip to content

Instantly share code, notes, and snippets.

View TobeTek's full-sized avatar
🎹
Learning the piano...

Emmanuel Katchy TobeTek

🎹
Learning the piano...
View GitHub Profile
@TobeTek
TobeTek / delete_django_migrations.sh
Created November 9, 2023 20:51
Delete all migrations in a Django project
#!/bin/bash
# Written by ChatGPT with some human help 🙂
# Loop through all apps in your project
for app in $(python manage.py showmigrations -l | grep -v '^\[ \]'); do
echo "Deleting migration files for $app..."
# Delete all migration files except __init__.py
find "$app/migrations" -name '00*.py' -not -name '__init__.py' -exec rm {} \;
/*
Author: Tobe :)
ZKP Circuits for a Game of Battleship
Circom: https://github.com/iden3/circom
3rd-Party circuits gotten from: https://github.com/iden3/circomlib
*/
pragma circom 2.1.5;
@TobeTek
TobeTek / utils.py
Created March 2, 2023 22:48
A cleaner approach to mocking unmanaged models in Django tests
"""
A cleaner approach to temporarily creating unmanaged model db tables for tests
"""
from unittest import TestCase
from django.db import connections, models
class create_unmanaged_model_tables:
"""
@TobeTek
TobeTek / vigenere_cipher.py
Last active July 9, 2023 01:55
Vigenere (Keyword) Cipher - Python
"""
Vignere (Keyword) Cipher implementation in Python
"""
import string
def generate_key(keyword: str, keyletter: str = "A") -> str:
"""
Generate a polyalphabetic cipher key
@rutcreate
rutcreate / README.md
Last active May 3, 2025 10:33
Install Python 3.10.x on Ubuntu 20.04

Prerequisite

sudo apt update
sudo apt install software-properties-common -y

Add custom APT repository

@TobeTek
TobeTek / custom_backtrader_timer.py
Created January 3, 2022 03:32
An OOP approach to Backtrader Timers
#!/usr/bin/env python
# -*- coding: utf-8; py-indent-offset:4 -*-
###############################################################################
#
# Copyright (C) 2021 Emmanuel Katchy
#
# This program 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 of the License, or
@rahularity
rahularity / work-with-multiple-github-accounts.md
Last active May 5, 2025 09:00
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
@cjies
cjies / vapid_helper.py
Created November 22, 2019 04:44
Python based VAPID key-pair generator
import base64
import ecdsa
def generate_vapid_keypair():
"""
Generate a new set of encoded key-pair for VAPID
"""
pk = ecdsa.SigningKey.generate(curve=ecdsa.NIST256p)
vk = pk.get_verifying_key()
@jult
jult / jbt-rules.cf
Last active March 9, 2025 15:31
SpamAssassin rules
# Put this file under /etc/spamassassin/ and run an sa-update or reload amavis etc.
#
#--------------------------------------------------
# The only RBL I trust, UCEPROTECT1 (single IP, not IP-ranges or entire ISPs) http://uceprotect.net
#--------------------------------------------------
header RCVD_IN_UCEPROTECT1 eval:check_rbl_txt('uceprotect1', 'dnsbl-1.uceprotect.net')
describe RCVD_IN_UCEPROTECT1 Listed in dnsbl-1.uceprotect.net
tflags RCVD_IN_UCEPROTECT1 net
score RCVD_IN_UCEPROTECT1 1.8
@AugustoL
AugustoL / ECRecover.sol
Created May 29, 2017 20:40
ECRecover Solidity Library
pragma solidity ^0.4.8;
// Based on https://gist.github.com/axic/5b33912c6f61ae6fd96d6c4a47afde6d
library ECRecover {
// ECRecovery Methods
// Duplicate Solidity's ecrecover, but catching the CALL return value
function safer_ecrecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal returns (bool, address) {