Skip to content

Instantly share code, notes, and snippets.

View yamule's full-sized avatar
💭
健康が一番大事

yamabuki-chan yamule

💭
健康が一番大事
  • Japan
View GitHub Profile
@yamule
yamule / gist:9248b31126891d76f105a2bc4dfe7567
Last active January 7, 2024 10:29
自分用スニペット
//------------ argparse
import argparse;
def check_bool(v):
v = v.lower();
if v == "true" or v == "1":
return True;
if v == "false" or v == "0":
return False;
raise Exception("true or false or 1 or 0 are expected.");
use std::collections::{HashMap, HashSet};
use std::io;
use std::cmp::Reverse;
use std::cmp::Ordering;
use std::collections::BinaryHeap;
use std::i64;
use std::f64;
#[allow(unused_imports)]
use rand::prelude::*;
@yamule
yamule / pdp.py
Last active January 1, 2022 14:52
Protein Domain Parser
#!/usr/bin/env python
# coding: utf-8
# In[1]:
"""
Copyright 2022 yamule
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
@yamule
yamule / pymol_obj_loader.py
Last active August 13, 2022 16:16
A simple script to load Wavefront OBJ file in PyMOL.
# A simple script to load OBJ file in PyMOL.
# "debug.obj" is the OBJ file made by SurfStamp https://github.com/yamule/SurfStamp-public .
# Because OBJ file is very flexible, the files which are created by other programs may not be loaded.
# Usage:
# 1. Save this script in the same directory with your OBJ.
# 2. Launch PyMOL.
# 3. Load this script from File-> Open (All Files (*))
# 4. Type the following command in the command field (The text field which have PyMOL> label).
# cmd.load_callback(myOBJCallback("debug.obj"),'unique_name');
@yamule
yamule / lock_with_sqlite.py
Last active July 6, 2019 05:52
mimic flock with sqlite
import sqlite3
import time
import random;
import sys;
locker_dbpath = "dummy_locker.db";
locker_tablename = "dummy_table";
locker_conn = None;
#public domain