Skip to content

Instantly share code, notes, and snippets.

View junipertcy's full-sized avatar
🐋
nuit blanche

Tzu-Chi Yen junipertcy

🐋
nuit blanche
View GitHub Profile
@dpgettings
dpgettings / dummyfig.tex
Created March 19, 2014 05:19
Fancy placeholder figures in LaTeX
%% This part goes in preamble
\newcommand{\dummyfig}[1]{
\centering
\fbox{
\begin{minipage}[c][0.33\textheight][c]{0.5\textwidth}
\centering{#1}
\end{minipage}
}
}
@hernamesbarbara
hernamesbarbara / README.md
Created June 8, 2014 19:10
A numpy implementation ~5× faster than using itertools.
@ksimek
ksimek / program_options_boilerplate.cpp
Last active December 28, 2023 05:12
Boilerplate code for a C++ program using boost program options. Usage string is automatically generated from positional arguments.
#include <boost/program_options.hpp>
#include <sstream>
#include <fstream>
#include <iterator>
#include <algorithm>
namespace po = boost::program_options;
class Options
{
@2shou
2shou / spark_log_extract.py
Last active August 8, 2019 13:30
log-extract script with Spark
# coding: utf-8
# command example:
# $ spark-submit spark_log_extract.py \
# --name test \
# --notblankkeys dn,stm,ev_ac,pg_url \
# --filterregex ".*(=ac_pl\`|=ac_dl\`).*" \
# --usegzip \
# /path/to/source \
# /path/to/atom \
@ByoungInKim
ByoungInKim / create_directory.py
Last active May 30, 2024 08:33
python - create directory if path if it doesn`t exist for file write
import os
directory = '/home/kenny/gist'
if not os.path.exists(directory):
os.makedirs(directory)
@laurencee9
laurencee9 / draw_curved_edges.py
Last active July 9, 2019 19:34
Draw curved network edges in python
import numpy as np
import matplotlib.patches as mpatches
import networkx as nx
from matplotlib.patches import FancyArrowPatch as ArrowPath
from matplotlib.font_manager import FontProperties
def draw_curved_edges(edges, pos, ax, mu=0.05, edge_color="black", edge_width=1.0, alpha=1.0, arrow_scale=20.0, loopsize=0):
"""
@jg-you
jg-you / orbits.py
Last active June 11, 2024 18:28
Computing the number of orbits in a graph, with dreadnaut (nauty), in python
# -*- coding: utf-8 -*-
"""
Wrapper around dreadnaut that computes the orbits of a graph.
NOTE: Must have installed `dreandaut`. The location of the binary can be passed
as an argument to `compute_automorphisms`.
Author: Jean-Gabriel Young <info@jgyoung.ca>
"""
import subprocess