Skip to content

Instantly share code, notes, and snippets.

View junetech's full-sized avatar

Juntaek HONG junetech

  • Pohang, Korea
  • 22:34 (UTC +09:00)
View GitHub Profile
@junetech
junetech / Microsoft.PowerShell_profile.ps1
Created November 15, 2024 02:27
Powershell profile for micromamba
$Env:MAMBA_ROOT_PREFIX="C:\Users\$Env:UserName\"
.\micromamba.exe shell hook -s powershell | Out-String | Invoke-Expression
# command alias micromamba as mamba
Set-Alias mamba micromamba
r"""
Copyright (c) 2024 MSO Lab.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
@junetech
junetech / is_subset_test.py
Created October 1, 2024 05:01
Python subset test
import numpy as np
set1 = {np.str_("a"), "b"}
set2 = frozenset({"a", "b"})
print(set1.issubset(set2)) # True
print(set2.issubset(set1)) # True
@junetech
junetech / hypergraph_utils.py
Created September 25, 2024 16:02
Utilities with hypergraph dictionary input
from typing import Any
from collections.abc import Hashable, Iterable
from itertools import combinations
def calc_adjacency_dict(hypergraph_dict: dict[Hashable, Iterable[Hashable]]) -> dict[Hashable, set[Hashable]]:
key_list = list(hypergraph_dict.keys())
hypergraph_set_dict = {key: set(hypergraph_dict[key]) for key in key_list}
return_dict = {key: set() for key in key_list}
for key1, key2 in combinations(key_list, 2):
if hypergraph_set_dict[key1] & hypergraph_set_dict[key2]:
@junetech
junetech / iguanatex_on_w11.md
Last active June 17, 2024 00:52
IguanaTex on PowerPoint for Windows

IguanaTex on PowerPoint for Windows

  • IguanaTex v1.61
  • Windows 11
  • PowerPoint version 2405

Install requirements

@junetech
junetech / init_windows_11.md
Created June 5, 2024 07:20
새로 Windows 11 설치

새로 Windows 11 설치

설치전

기존 파일 백업

  • USB 메모리, 외장하드, 외장SSD, 혹은 대용량 클라우드 드라이브 준비
  • 파일 탐색기 왼쪽의 다음 항목을 백업:
    • 바탕 화면
  • 다운로드
@junetech
junetech / mamba_on_w11.md
Last active June 5, 2024 07:06
Mamba on Windows 11

Mamba on Windows 11

Package manager인 mamba를 Windows 11의 PowerShell에서 사용할 수 있도록 셋업하기

Why?

  • conda와 사용방법이 거의 동일
  • conda보다 빠르다
    • conda는 Python으로 구현되어있으나, mamba는 C++로 구현
  • 패키지 다운로드시 여러 파일 동시 다운로드
@junetech
junetech / main.py
Last active May 8, 2024 05:31
Python file boilerplate
LOG_FILENAME = "mylog.log"
LOG_ENCODING = "utf-8"
def main():
print("Hello world!")
if __name__ == "__main__":
import datetime
@junetech
junetech / nextcloud_on_fedora_38.md
Last active October 25, 2023 06:01
Nextcloud on Fedora Workstation 38

Nextcloud on Fedora Workstation 38

Initialization

  • Configuration of self generated SSL certificate
    • Append export ssl_name="my_domain_name" to ~/.bashrc
      • Replace "my_domain_name" with the domain name(e.g. lists.fedoraproject.org)
    • # dnf install openssl
    • # mkdir ~/certs
    • # cd ~/certs
@junetech
junetech / gist:b6b374ce5ca20c34feb18ad58399d027
Last active June 13, 2023 02:43 — forked from djsmith42/gist:3956189
Console output suppressor for Python code
"""http://thesmithfam.org/blog/2012/10/25/temporarily-suppress-console-output-in-python/
https://stackoverflow.com/questions/36956083/how-can-the-terminal-output-of-executables-run-by-python-functions-be-silenced-i
"""
import os
import sys
from contextlib import contextmanager
@contextmanager
def suppress_stdout():