This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz | |
tar xvf install-tl-unx.tar.gz | |
cd install-tl-* | |
sudo ./install-tl | |
# export PATH="$PATH:/usr/local/texlive/2017/bin/x86_64-linux" | |
sudo tlmgr path add | |
sudo tlmgr install --self --all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo tlmgr install \ | |
collection-langjapanese \ | |
nag here \ | |
newtx txfonts helvetic fontaxes boondox \ | |
kastrup tex-gyre \ | |
standalone multirow letltxmacro \ | |
beamer bxdpx-beamer pgfplots \ | |
refcheck |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DictDiffer(object): | |
""" | |
Calculate the difference between two dictionaries as: | |
(1) items added | |
(2) items removed | |
(3) keys same in both but changed values | |
(4) keys same in both and unchanged values | |
""" | |
def __init__(self, current_dict, past_dict): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import threading | |
class WaitingAnimation: | |
def __init__(self): | |
self.finished = False | |
def animation(self): | |
animation = "|/-\\" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import fcntl | |
import struct | |
def get_ip_address(ifname): | |
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
return socket.inet_ntoa(fcntl.ioctl( | |
s.fileno(), | |
0x8915, # SIOCGIFADDR | |
struct.pack('256s', ifname[:15]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import urllib2 | |
true_socket = socket.socket | |
def make_bound_socket(source_ip): | |
def bound_socket(*a, **k): | |
sock = true_socket(*a, **k) | |
sock.bind((source_ip, 0)) | |
return sock | |
return bound_socket |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://en.wikipedia.org/wiki/Binary_GCD_algorithm | |
def binary_gcd(a, b): | |
g = 1 | |
odd = 1 | |
while a > 0: | |
if (a & odd) == 0 and (b & odd) == 0: | |
a >>= 1 # g /= 2 | |
b >>= 1 # b /= 2 | |
g <<= 1 # g *= 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.ssh/config | |
Host local1 | |
Port 22 | |
HostName 127.0.0.1 | |
User root | |
Host local2 | |
Port 22 | |
HostName 192.168.1.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TYPE=Ethernet | |
PROXY_METHOD=none | |
BROWSER_ONLY=no | |
BOOTPROTO=static | |
DEFROUTE=yes | |
IPV4_FAILURE_FATAL=no | |
NAME=enp0s8 | |
DEVICE=enp0s8 | |
ONBOOT=yes | |
ZONE=public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 答えの確認用 | |
import numpy as np | |
p = 337 | |
f = np.poly1d([1,0,0,0,0,0,0,0,1]) | |
p1 = np.poly1d([334, 180, 335, 283, 72, 123, 112, 19]) | |
p2 = np.poly1d([325, 304, 135, 76, 127, 83, 191, 272]) |