Skip to content

Instantly share code, notes, and snippets.

Avatar

Yosuke Mizutani mogproject

View GitHub Profile
View Bookmarks.md
@mogproject
mogproject / GurobiCheatsheet.md
Last active April 26, 2022 06:14
Gurobi Cheatsheet
View GurobiCheatsheet.md

Python

import gurobipy as gp
from gurobipy import GRB

with gp.Env(empty=True) as env:
    env.start()

    with gp.Model(env=env) as m:
@mogproject
mogproject / time_convert.py
Created September 27, 2021 00:06
time_convert.py
View time_convert.py
#!/usr/bin/env python
import sys
import fileinput
import re
diff = -8
def repl(matched):
h = int(matched.group(1)) + diff
View c_graph_ops_example.cpp
static inline int encode_distance(int start, int distance) { return ((start + 1) << 4) + distance; }
static inline int decode_distance(int x) { return x & ((1 << 4) - 1); }
static inline int node_visited(int x, int v) { return (x >> 4) == v + 1; }
template <typename Graph>
static void extend_closed_neighborhood(Graph const& G, Graph& H, int v, int radius, int buffer[]) {
assert(0 <= v && v < G.number_of_nodes());
assert(radius >= 0);
@mogproject
mogproject / run_with_timeout.sh
Created July 24, 2021 23:19
Example of running a command with time limit but not affecting the errexit option in bash.
View run_with_timeout.sh
#!/bin/bash
TIMEOUT=timeout
run_with_timeout() {
oldopt=$-
set +e
$TIMEOUT $@
ret=$?
if [[ $ret -eq 124 ]]; then
@mogproject
mogproject / launch.py
Last active March 3, 2021 01:06
Santorini benchmark launcher.
View launch.py
#!/usr/bin/env python3
"""
Santorini benchmark launcher.
"""
__author__ = 'Yosuke Mizutani'
__version__ = '0.0.4'
__license__ = 'Apache License, Version 2.0'
import sys
@mogproject
mogproject / visualize.py
Last active May 10, 2023 13:42
Visualizing graphs with Plotly.
View visualize.py
# Original version: https://gist.github.com/mogproject/50668d3ca60188c50e6ef3f5f3ace101
from collections import defaultdict
import networkx as nx
import plotly.graph_objects as go
from typing import Any, List, Dict, Tuple, Union, Callable
Vertex = Any
Edge = Tuple[Vertex, Vertex]
Num = Union[int, float]
View MovingFromNC2UT.md

Raleigh, NC -> Salt Lake City, Utah 引越しメモ

1ヶ月前

  • 所持品の整理、何を破棄し何を持っていくか
  • 引っ越し日程の確定
  • 移動のための片道航空券を購入
  • Amazon で段ボール箱(moving boxes)を購入

2週間前

@mogproject
mogproject / LiveStreamingCheatSheet.md
Last active June 14, 2020 00:12
How to set up the live streaming environment on Mac
View LiveStreamingCheatSheet.md

Lighting

  • 30W LED Floor Lamp

Network

  • Wired internet connection

Audio

@mogproject
mogproject / PyGitHub.md
Last active May 16, 2022 18:25
Accessing Issues on GitHub Enterprise using PyGitHub
View PyGitHub.md

How to Access Issues on GitHub Enterprise

Setup

1. Install PyGitHub

pip install PyGitHub

You may want to use pip3 instead of pip.