Skip to content

Instantly share code, notes, and snippets.

View uchan-nos's full-sized avatar

Kota UCHIDA uchan-nos

View GitHub Profile
#include <cstdint>
template <class T>
T ConvEndian(T orig) {
T result{};
for (int i = 0; i < sizeof(T); ++i) {
result <<= 8;
result |= orig & 0xff;
orig >>= 8;
}
@uchan-nos
uchan-nos / mt.cpp
Last active March 18, 2019 04:22
Multi threading in C++17
#include <iostream>
#include <chrono>
#include <string>
#include <thread>
#include <atomic>
#include <vector>
#include <queue>
#include <mutex>
#include <condition_variable>
uchan@uchan-lavie:~/test$ git retag osbook_ b444d5d master
re-tagging b444d5ddda79b860cd8d0f20154a3a9444507d80 --> 02708132b7688c77ffe69dfd0af94fe564e4f6c0
27adb4cc7834e1118c8122b0c09ee4b0ba5e8a00
/\
.-' `-.
/ \
3f4a42eb107299a6baa32c14ef560faed98fd5d4 110fc8a82beaa5a58c8b561c0a46a21cdd5558ad
Wed Sep 26 13:00:06 2018 Wed Sep 26 13:00:06 2018
add b add b
@uchan-nos
uchan-nos / history_of_attacking_system_program.md
Created July 23, 2018 03:04
システムソフトウェアに対する攻撃の歴史と傾向の読書メモ

「システムソフトウェアに対する攻撃の歴史と傾向」の読書メモ

対象記事:システムソフトウェアに対する攻撃の歴史と傾向

サイバー攻撃の始まり

  • 1972 年:バッファオーバーフローのバグを利用した攻撃について公に言及された
  • 1988 年:Morris Worm がバッファオーバーフローバグを侵入のための手段として用いる事で,バッファオーバーフローのバグが実用的な攻撃として認知され始めた
  • 1991 年:Linux 初リリース
@uchan-nos
uchan-nos / superfence_vanish_pymdown_extensions.md
Last active June 20, 2018 05:23
investigation log about a "superfence vanishing" bug of pymdown-extensions

NEC LaVie Nybrid ZERO の内蔵 SSD 性能メモ.

PC 本体の型番:PC-GN246W3A4

換装前の SSD 品番はサムスン MZ-NTE128

uchan@uchan-lavie:/$ lsblk -io NAME,TYPE,SIZE,MOUNTPOINT,FSTYPE,MODEL
NAME   TYPE   SIZE MOUNTPOINT             FSTYPE MODEL
sda    disk 119.2G                               SAMSUNG MZNTE128
@uchan-nos
uchan-nos / character-encoding.md
Created May 26, 2018 04:59
文字コードに関するメモ書き

文字コード

文字コードに関するおすすめの記事 文字列 - Dive Into Python 3

Unicode

Unicode と個別のエンコーディング方式(UCS-2,UCS-4,UTF-8,UTF-16)の違いを意識するのは大事

  • Unicode は文字の集合.世界中の文字や絵文字などをすべて含む(のを目標にして拡張が続いている)
  • エンコーディング方式は,Unicode 文字をメモリやディスクに格納するためにバイト列に変換する方法
#include <stdio.h>
void func(void)
{
int a[100];
int n, m = 0;
scanf("%d", &n);
for (int i = 0; i < n; ++i)
{
scanf("%d", a + i);
__attribute__ ((no_caller_saved_registers))
extern "C" void Inthandler40(void)
{
...
0000000000100920 <Inthandler40>:
100920: 55 push rbp
100921: 48 89 e5 mov rbp,rsp
100924: 50 push rax
100925: 41 53 push r11
@uchan-nos
uchan-nos / cleanup.sh
Last active December 14, 2017 09:28
bug detail: mdadm may broke bbl if bitmap is too large
#!/bin/sh -ux
. ./variables.sh
for version in xenial zesty artful
do
MDADM=$ARCHIVES/$version/contents/sbin/mdadm
sudo $MDADM -S /dev/md/$version
sudo $MDADM -r /dev/md/$version
sudo $MDADM -S /dev/md/${version}_nobb