Skip to content

Instantly share code, notes, and snippets.

View macleginn's full-sized avatar

Dmitry Nikolayev macleginn

View GitHub Profile
@OmerShapira
OmerShapira / Israel-Palestine Resources.md
Last active November 14, 2023 07:55
Israel-Palestine: High-Impact Short Articles

Israel-Palestine Resources

The purpose of this list is to provide a high-impact introduction to the main players and ideologies in the tensions between Israel and Palestine. The wikipedia articles linked here all refer to first sources, and my curation attempts to remove a single narrative, insofar that this is even possible.

This list skips easily googleable articles ("Hamas", "1967 War", etc). It also skips articles that focus on a single viewpoint ("Palestinian Political Violence", "Greater Israel", etc). Please use these articles as a starting point to research. This is not a complete list, it simply provides key points to begin with.

  1. The Sykes-Picot Agreement - Map of colonial interests in the Levant at the heels of the decline of the Ottoman Empire. This isn't the beginning of history, but a good place to start.
  2. McMahon-Hussein Correspondence - Key piece to understandin
@nlgranger
nlgranger / sort_pdist.py
Created July 27, 2018 15:49
sort pairwise distance matrix
# like https://gmarti.gitlab.io/ml/2017/09/07/how-to-sort-distance-matrix.html
# but using just 4 lines of code thanks to 'optimal_ordering' argument
# added to scipy.cluster.hierarchy.linkage
import matplotlib.pyplot as plt
import numpy as np
from scipy.cluster.hierarchy import linkage
# distance matrix
m = np.zeros((500, 500))
@shafik
shafik / WhatIsStrictAliasingAndWhyDoWeCare.md
Last active May 8, 2024 17:59
What is Strict Aliasing and Why do we Care?

What is the Strict Aliasing Rule and Why do we care?

(OR Type Punning, Undefined Behavior and Alignment, Oh My!)

What is strict aliasing? First we will describe what is aliasing and then we can learn what being strict about it means.

In C and C++ aliasing has to do with what expression types we are allowed to access stored values through. In both C and C++ the standard specifies which expression types are allowed to alias which types. The compiler and optimizer are allowed to assume we follow the aliasing rules strictly, hence the term strict aliasing rule. If we attempt to access a value using a type not allowed it is classified as undefined behavior(UB). Once we have undefined behavior all bets are off, the results of our program are no longer reliable.

Unfortunately with strict aliasing violations, we will often obtain the results we expect, leaving the possibility the a future version of a compiler with a new optimization will break code we th

@georgexsh
georgexsh / goto.py
Created September 18, 2017 07:47
python goto with system trace function
import sys
def j(lineno):
frame = sys._getframe().f_back
called_from = frame
def hook(frame, event, arg):
if event == 'line' and frame == called_from:
try:
frame.f_lineno = lineno
@connorjan
connorjan / rsub.md
Last active March 6, 2024 21:06
Editing Files Remotely via SSH on SublimeText 3

Editing Files Remotely via SSH on SublimeText 3

Sometimes you need to edit a file on a remote server, but using vim/emacs is not very practical, due to lag and speed of screen refresh.

TextMate users have the classic rmate, but it was implemented in Ruby, which may not be available on the remote server.

A better option is to use this version of rmate, implemented in pure Bash. It's a single file, self-contained, and with no external dependencies.

Step by step: