Skip to content

Instantly share code, notes, and snippets.

View tex2e's full-sized avatar
🕶️
Ready to engage

Mako tex2e

🕶️
Ready to engage
View GitHub Profile
@tex2e
tex2e / tlmgr-install-packages.sh
Last active January 31, 2020 03:34
Install my packages in texlive.
sudo tlmgr update --self --all
sudo tlmgr install \
collection-latexrecommended collection-fontsrecommended collection-langjapanese \
newtx txfonts helvetic fontaxes boondox \
kastrup tex-gyre \
here multirow letltxmacro \
beamer bxdpx-beamer pgfplots \
standalone \
refcheck
@tex2e
tex2e / main.py
Last active December 13, 2019 08:21
GF(2^8) 法既約多項式 x^8 + x^4 + x^3 + x + 1 の掛け算
def xtime(x):
res = (x << 1) ^ (0x1b if (x & 0x80) else 0x00)
return res & 0xFF
def dot(x, y):
product = 0
mask = 0x01
while mask:
if y & mask:
print(hex(x))
@tex2e
tex2e / main.py
Created September 24, 2019 12:02
factorization by order
import math
def find_order(m, N):
for r in range(1, N):
if pow(m, r, N) == 1:
return r
N = 35
for m in range(2, N):
print('----------')
@tex2e
tex2e / proverif.cson
Created September 3, 2019 10:24
atom language-proverif settings (~/.atom/packages/language-proverif/settings/proverif.cson)
'.source.proverif':
'editor':
'commentStart': '(* '
'commentEnd': ' *)'
'increaseIndentPattern': 'process'
@tex2e
tex2e / ssh_config
Created July 24, 2019 05:13
ssh/config (github, bitbucket)
Host github.com
HostName github.com
IdentityFile ~/.ssh/id_ed25519
User git
Host bitbucket.org
HostName bitbucket.org
IdentityFile ~/.ssh/id_ed25519
User git
Port 22
@tex2e
tex2e / ntt-poly-verify.py
Last active May 23, 2019 13:22
数論変換 (NTT) による有限体上の多項式環の乗算:p1, p2 ∈ Z_337[x] / (x^9 + 1)
# 答えの確認用
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])
@tex2e
tex2e / ifcfg-enp0s8
Created January 14, 2019 12:17
centos7 network config on virtual box
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
NAME=enp0s8
DEVICE=enp0s8
ONBOOT=yes
ZONE=public
@tex2e
tex2e / config
Created January 14, 2019 12:07
多段ssh
# ~/.ssh/config
Host local1
Port 22
HostName 127.0.0.1
User root
Host local2
Port 22
HostName 192.168.1.2
@tex2e
tex2e / binaryGCD.py
Created December 30, 2018 00:36
binary GCD (バイナリ・ユークリッドの互除法)
# 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
@tex2e
tex2e / make_bound_socket.py
Created December 13, 2018 10:07
make bound socket with source_addr
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