Skip to content

Instantly share code, notes, and snippets.

View themichaelusa's full-sized avatar

Michael Usachenko themichaelusa

View GitHub Profile
@lirsacc
lirsacc / script.py
Last active November 22, 2024 02:56
Playing with Python's operator overloading to support the pipe functional operator from Elixir.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Small experiment with Python's operator overloading to add support for
composing function with the pipe operator similar to Elixir's pipe operator.
The main use case of such technique I see is to build isolated DSL.
This approach uses decorators to achieve the given result which forces you
to wrap all the functions you want to use this way. The runtime cost should
be minimal however this might be a problem in some context. It also prevents you
@urigoren
urigoren / mcl.py
Last active April 17, 2024 23:52
Markov clustering algorithm
import numpy as np
from scipy.sparse import linalg, eye, csr_matrix
from sklearn.preprocessing import normalize
from sklearn.metrics.pairwise import pairwise_distances
from collections import defaultdict
class MarkovClustering:
def __init__(self, matrix, metric="cosine", bias=1):
@NickSeagull
NickSeagull / ubuntu-bloat-removal.sh
Last active June 2, 2026 14:36
Updated Jan 22nd, 2024 - Simple command to remove all "bloatware" from ubuntu
sudo apt-get remove \
aisleriot \
brltty \
duplicity \
empathy \
empathy-common \
example-content \
gnome-accessibility-themes \
gnome-contacts \
gnome-mahjongg \

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@msrose
msrose / combining-git-repositories.md
Last active June 17, 2026 00:51
How to combine two git repositories.

Combining two git repositories

Use case: You have repository A with remote location rA, and repository B (which may or may not have remote location rB). You want to do one of two things:

  • preserve all commits of both repositories, but replace everything from A with the contents of B, and use rA as your remote location
  • actually combine the two repositories, as if they are two branches that you want to merge, using rA as the remote location

NB: Check out git subtree/git submodule and this Stack Overflow question before going through the steps below. This gist is just a record of how I solved this problem on my own one day.

Before starting, make sure your local and remote repositories are up-to-date with all changes you need. The following steps use the general idea of changing the remote origin and renaming the local master branch of one of the repos in order to combine the two master branches.

@ctokheim
ctokheim / cython_tricks.md
Last active March 4, 2024 23:27
cython tricks

Cython

Cython has two major benefits:

  1. Making python code faster, particularly things that can't be done in scipy/numpy
  2. Wrapping/interfacing with C/C++ code

Cython gains most of it's benefit from statically typing arguments. However, statically typing is not required, in fact, regular python code is valid cython (but don't expect much of a speed up). By incrementally adding more type information, the code can speed up by several factors. This gist just provides a very basic usage of cython.

@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active July 15, 2026 19:11
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@weakish
weakish / code.md
Last active August 23, 2024 15:32
The Six Most Common Species Of #Code #java #fun
@reimund
reimund / dict2xml.py
Last active February 24, 2025 03:45
Simple dictionary to xml serializer.
"""
Simple xml serializer.
@author Reimund Trost 2013
Example:
mydict = {
'name': 'The Andersson\'s',
'size': 4,