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
/*
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
@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 July 8, 2024 06:07
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 May 20, 2024 23:21
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) {
@tylermakin
tylermakin / Multipart MIME Email.md
Last active May 7, 2024 21:24
Multipart MIME Email Guide

Multipart MIME Email Guide

This is a guide on how to send a properly formatted multipart email. Multipart email strings are MIME encoded, raw text email templates. This method of structuring an email allows for multiple versions of the same email to support different email clients.

// Example Multipart Email:
From: sender@example.com
To: recipient@example.com
Subject: Multipart Email Example
Content-Type: multipart/alternative; boundary="boundary-string"
@jcausey-astate
jcausey-astate / sendemail.py
Last active April 3, 2023 06:06
Send email using Python without requiring an MTA or installing sendmail. Adapted from https://moythreads.com/wordpress/2015/07/09/sending-email-with-python-without-an-mta/
#!/usr/bin/env python2.7
#
# Send email without requiring account credentials to be stored on the
# Docker instance.
#
# Adapted from:
# https://moythreads.com/wordpress/2015/07/09/sending-email-with-python-without-an-mta/
#
# Dependencies:
# `smtplib` (pip install smtplib to install)