Language | Code |
---|---|
Afrikaans | af |
Arabic | ar |
Bulgarian | bg |
Bangla | bn |
Bosnian | bs |
Catalan | ca |
Czech | cs |
Welsh | cy |
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
#coding:utf-8 | |
import urllib.request | |
import json | |
# トークン発行 | |
def get_access_token(key): | |
headers = { | |
'Ocp-Apim-Subscription-Key': key, | |
'Content-Length': 0 |
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
// (k,n)-threshold scheme | |
#include<iostream> | |
#include<stdio.h> | |
#include <random> | |
#include <vector> | |
#include <cmath> | |
using namespace std; | |
#define prime 65537 |
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
% Copyright 2018 by Keitaro Hashimoto | |
% | |
% This file may be distributed and/or modified | |
% | |
% 1. under the LaTeX Project Public License and/or | |
% 2. under the GNU Public License. | |
% | |
% See the file doc/licenses/LICENSE for more details. | |
\mode<presentation> |
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
#! /usr/bin/env python3 | |
# -*- coding:utf-8 -*- | |
# 参考:http://d.hatena.ne.jp/greennoah/20090216/1234784592 | |
import re | |
import sys | |
import os | |
# $...$で囲まれたインライン数式用の置換 | |
def inline_replace(line): |
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
# -*- coding: utf-8 -*- | |
import math | |
import random | |
def quick_sort(arr): | |
l = len(arr) | |
if l < 1: | |
return arr | |
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 functools | |
def gcd(x, y): | |
''' | |
Euclidean Algorithm | |
return gcd(x, y) | |
''' | |
while y: | |
x, y = y, x % y | |
return x |
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
# -*- coding : utf-8 -*- | |
def decrypt_RSA(private_key_loc, package): | |
from Crypto.PublicKey import RSA | |
from Crypto.Cipher import PKCS1_OAEP | |
from base64 import b64decode | |
key = open(private_key_loc, "r").read() | |
rsakey = RSA.importKey(key) | |
rsakey = PKCS1_OAEP.new(rsakey) | |
decrypted = rsakey.decrypt(b64decode(package)) |
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
# -*- coding: utf-8 -*- | |
''' | |
英文ファイルを読み込んで頻度分析を行うサンプル | |
''' | |
from collections import OrderedDict | |
def frequency_analysis(text): | |
''' | |
与えられたtextに対して頻度分析を行う。 | |
結果はアルファベット順に各文字の頻度が標準出力に出力される。 |
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 java.net.NetworkInterface; | |
import java.util.Enumeration; | |
public class Main { | |
public static void main(String[] args) throws Exception{ | |
Enumeration<NetworkInterface> nics = NetworkInterface.getNetworkInterfaces(); | |
while (nics.hasMoreElements()) { | |
NetworkInterface ni = nics.nextElement(); | |
if(ni.getHardwareAddress() != null && ni.isUp() && ni.getHardwareAddress().length == 6) { |
NewerOlder