Skip to content

Instantly share code, notes, and snippets.

View mogproject's full-sized avatar

Yosuke Mizutani mogproject

View GitHub Profile
@mogproject
mogproject / CSSDM24.md
Last active July 4, 2024 22:11
CSSDM24

Poset Inequalities

Day 3

Problem 1

Recall: $\displaystyle e(P-y) = \sum_{C \in \mathcal{C}\colon y\in C} |\{f \in \mathcal{E}(P) : \Phi(f) = C\}|$.

Then,

$$$$
@mogproject
mogproject / feign-2024-04-20.css
Last active April 26, 2024 10:51
Custom CSS for Feign running with OBS/Discord Streaming Kit.
/*
* Custom CSS for Feign running with OBS/Discord Streaming Kit.
*
* Recommended browser size: w2600 x h400
*
* Modified based on:
* - https://piyonyuxu.fanbox.cc/posts/4943228
* - https://obs-discord-picture.alfebelow.com/
* - https://koumi-hashiba.fanbox.cc/posts/7790890
*/
@mogproject
mogproject / horizontal.css
Last active April 26, 2024 03:22
Custom horizontal layout CSS running with OBS/Discord Streaming Kit.
/*
* Custom horizontal layout CSS running with OBS/Discord Streaming Kit.
*
* Recommended browser size: w2600 x h400
*/
[class*="Voice_voiceStates__"] {
display: flex;
flex-wrap: nowrap;
margin: 32px 2px 2px 2px;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mogproject
mogproject / icpc_pypy.md
Last active October 6, 2023 22:47
How to set up PyPy 3 for problemtools/icpc on Docker

0. Assumptions

1. Set up Docker image

  • Install and start Docker Desktop
  • Download image: docker pull problemtools/icpc
@mogproject
mogproject / GurobiCheatsheet.md
Last active April 26, 2022 06:14
Gurobi Cheatsheet

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
#!/usr/bin/env python
import sys
import fileinput
import re
diff = -8
def repl(matched):
h = int(matched.group(1)) + diff
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.
#!/bin/bash
TIMEOUT=timeout
run_with_timeout() {
oldopt=$-
set +e
$TIMEOUT $@
ret=$?
if [[ $ret -eq 124 ]]; then