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 / app.m
Last active July 23, 2025 15:31
Soil Health Advisor - MATLAB App - Get AI powered advice on how to manage your farm for your crops
classdef app1_exported < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
GetAIpoweredinsightsforyourfarmLabel matlab.ui.control.Label
SoilHealthAdvisorLabel matlab.ui.control.Label
StatusIdleLabel matlab.ui.control.Label
TipsTextArea matlab.ui.control.TextArea
TipsTextAreaLabel matlab.ui.control.Label
@TobeTek
TobeTek / searchtrigger_migrations.py
Created June 23, 2024 20:13
A django management command to create migrations automatically for all models with Postgres' SearchVectorField
import os
import string
from collections import defaultdict
from django.core.management.base import BaseCommand, CommandError
from django.db import migrations
from django.db.migrations.writer import MigrationWriter
from django.db.models import Model
MIGRATION_FILE_NAME = "searchvectortrigger"
@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 / models.py
Last active January 29, 2024 15:41
Querying Django's JSON Field
from django.db import models
from django.utils.translation import gettext_lazy as _
class Person(models.Model):
"""
Store data about people in a school
"""
name = models.CharField(max_length=100)
@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
# ./main.py
# -----------------------------------
# new imports
import aiohttp
import asyncio
import async_api
import sync_api
from timeit import default_timer as timer
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
/**
* @title Ballot
* @dev Implements voting process along with vote delegation
*/
contract Ballot {
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
/**
* @author Tobe:)
* @title BasicStorage
* @dev Store & retrieve unsigned integer
*/
contract HelloWorld {