Skip to content

Instantly share code, notes, and snippets.

View nukopy's full-sized avatar

Yosuke Okuwaki nukopy

View GitHub Profile
@nukopy
nukopy / abc088c.cpp
Created January 5, 2019 12:56
ABC088: C - Takahashi's Information
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator> // std::back_inserter()
#include <set>
#include <map>
#include <algorithm> // std::copy()
#include <functional> // std::greater<T>()
#include <utility> // std::swap()
@nukopy
nukopy / abc033_c.cpp
Created February 10, 2019 01:59
ABC033 - C: 数式の書き換え
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
ll ctoi(char c){
if('0' <= c && c <= '9') return (c-'0');
@nukopy
nukopy / calc_two_complement.cpp
Last active November 10, 2019 16:14
Calculate 2's complement
#include <iostream>
#include <bitset>
using namespace std;
int calcTwoComlement(signed int n) {
// 2 の補数を算出する関数:ビット反転して 1 を足す
return ~n + 0b01;
}
int main() {
@nukopy
nukopy / extract-html-table-with-pandas.py
Last active May 12, 2020 16:48
Web ページの <table> から Markdown 用のテーブルを吐き出す
import pandas as pd
def main():
# requirements: pandas, lxml, tabulate
# 正規表現のサイトから「記号」のテーブルを抽出し,Markdown 用のテーブルを出力
url = 'https://murashun.jp/blog/20190215-01.html'
list_table = pd.read_html(url)
for t in list_table:
print(t.to_markdown())
@nukopy
nukopy / description.md
Last active October 26, 2020 08:26
The order of constructor/destructor on base/derived class(基底クラス,派生クラスにおけるコンストラクタ,デストラクタの順序)

C++:継承とコントラクタとデストラクタ

クラスを継承した場合,コンストラクタとデストラクタの呼び出される順序には注意が必要である.コンストラクタとデストラクタの呼び出しは,以下の順番となる.

  1. 親クラスのコンストラクタ
  2. 子クラスのコンストラクタ
  3. インスタンスの主な処理
@nukopy
nukopy / starship.toml
Created November 1, 2020 14:34
Simple theme with Starship
########################################
# prompt global settings
########################################
# document link: https://starship.rs/ja-JP/config/#%E3%83%95%E3%82%9A%E3%83%AD%E3%83%B3%E3%83%95%E3%82%9A%E3%83%88
# format = "$all"
format = """
$username\
$hostname\
$shlvl\
@nukopy
nukopy / starship.toml
Created November 1, 2020 16:02
Nerd Font Symbols created by Starship. This is a Starship default config.
# Starship default config, extracted from the source
# Configure the format of the prompt
format = """\
$username\
$hostname\
$shlvl\
$singularity\
$kubernetes\
$directory\
@nukopy
nukopy / starship.toml
Created November 1, 2020 16:04
Power line theme
# Starship default config, extracted from the source
# Configure the format of the prompt
format = """\
$username\
$hostname\
$shlvl\
$singularity\
$kubernetes\
$directory\
@nukopy
nukopy / template.yml
Created November 13, 2020 02:39
CFn template
Resources:
# IAM Policy
PolicyLambdaBasicExecution:
Type: AWS::IAM::ManagedPolicy
Properties:
ManagedPolicyName: !Sub "${Prefix}-policy-lambda-basic-execution"
PolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
@nukopy
nukopy / .latexmkrc
Last active January 5, 2021 04:07
Minimum settings for LaTeX in Docker on VSCode with extensions "Remote - Containers", "LaTeX Workshop"
#!/usr/bin/env perl
$pdf_mode = 3;
$latex = 'uplatex --kanji=utf8 -synctex=1 -file-line-error -halt-on-error %O %S';
$bibtex = 'upbibtex';
$dvipdf = 'dvipdfmx %O -o %D %S';
$makeindex = 'mendex %O -o %D %S';