Skip to content

Instantly share code, notes, and snippets.

TMUX(1) BSD General Commands Manual TMUX(1)
NAME
tmux — terminal multiplexer
SYNOPSIS
tmux [-2CluvV] [-c shell-command] [-f file] [-L socket-name]
[-S socket-path] [command [flags]]
DESCRIPTION
@pn11
pn11 / singleton.py
Last active September 17, 2019 15:43
Singleton in Python3
import threading
class ThreadingSingleton:
_instance = None
_lock = threading.Lock()
def __init__(self):
print('__init__')
def __new__(cls):
@pn11
pn11 / prirority_queue.py
Created September 16, 2019 02:55
Priority queue
import heapq as hq
que = []
hq.heappush(que, (1, "TEST1"))
hq.heappush(que, (0, "TEST0"))
hq.heappush(que, (2, "TEST2"))
print(que)
priority, a = hq.heappop(que)
print(priority, a)
@pn11
pn11 / 2d_array.py
Created August 14, 2019 12:47
Creating two-dimensional array in Python. Result -> https://ideone.com/M2TpNg
li = [[]] * 2
print(li)
li[0].append(1)
print(li)
print(id(li[0]))
print(id(li[1]))
li2 = [[] for _ in range(2)]
@pn11
pn11 / 0_README.md
Last active June 1, 2019 11:45
Retrieve Gists using GitHub API and Python3

Gists の API はこちら。

昔の Gist にたまにコメントついたりしてて気づかないことがあるので、API で取ろうとした。コメント数はとれるけどスター数やフォーク数は取れない。
あと新しいものから30個しか取れてない。

@pn11
pn11 / AHK_popup.md
Last active November 9, 2018 14:21
Pop-up window with AutoHotKey. AutoHotKey でポップアップ

Code

Progress, cbRed ct900000 cwBlue, test
Sleep 1500
Progress, Off

SplashTextOn,,, てすと
Sleep 1500
SplashTextOff
FROM python:3.5
RUN apt-get update && \
apt-get install -y git wget gzip
RUN git clone https://www.github.com/ildoonet/tf-openpose && \
cd tf-openpose && \
pip3 install -r requirements.txt && \
pip3 install opencv-python tensorflow && \
python setup.py install
@pn11
pn11 / docker_mount_currentdir.PS1
Created October 2, 2018 11:24
Mount current directory on a docker container using PowerShell.
$current_path = $(Resolve-Path .).ToString()
docker run -v ${current_path}:/data ubuntu bash
@pn11
pn11 / docker_image_exists.PS1
Created October 2, 2018 11:18
Check existence of Docker Image in PowerShell.
$TAG = "ubuntu"
$IMAGE_ID = $(docker images -q $TAG)
if ($IMAGE_ID){
Write-Output "Docker Image ${IMAGE_ID} found."
}
else{
Write-Output "Docker Image not found."
}
@pn11
pn11 / problem_A.py
Created June 3, 2018 07:32
AtCoder 2018/06/02
A = int(input())
B = int(input())
for i in reversed(range(A+1)):
if i % B == 0:
print(i)
break