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
@neomatrix369
neomatrix369 / PerformanceRelated.md
Last active November 3, 2023 20:27
Interesting links in the areas of HPC, low latency, mechanical harmony/sympathy, garbage collection
@finalfantasia
finalfantasia / what_a_good_commit_message_looks_like.md
Last active April 6, 2024 18:38
What a good commit message looks like (Linus Torvalds)

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

@kissgyorgy
kissgyorgy / sqlalchemy_conftest.py
Last active June 26, 2024 20:01
Python: py.test fixture for SQLAlchemy test in a transaction, create tables only once!
from sqlalchemy import create_engine
from sqlalchemy.orm import Session
from myapp.models import BaseModel
import pytest
@pytest.fixture(scope="session")
def engine():
return create_engine("postgresql://localhost/test_database")
@treyhunner
treyhunner / time_count_functions.py
Last active September 18, 2023 20:21
Test performance of different counting functions in Python
"""
Test performance of these counting methods:
- count_if_else: Set to 1 if not yet seen and increment otherwise
- count_if: Set to 0 if not yet seen, then increment regardless of containment
- count_exception: Attempt to increment and set to 1 if KeyError caught
- count_setdefault: Set default value to 0, then increment
- count_fromkeys: Create dict with necessary keys set to 0, then increment each
- count_set_and_comprehension: Create dict of items and counts using a set
- count_defaultdict: Increment count, automatically setting unseen values to 0
@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active July 8, 2024 06:24
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@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)
@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"
@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) {
@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
@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()