Skip to content

Instantly share code, notes, and snippets.

View maekawatoshiki's full-sized avatar
🙃
Pursuing a master's degree

uint256_t maekawatoshiki

🙃
Pursuing a master's degree
View GitHub Profile
@maekawatoshiki
maekawatoshiki / delete_git_submodule.md
Created July 6, 2023 02:25 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
    • git config -f .git/config --remove-section submodule.サブモジュールのパス
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@maekawatoshiki
maekawatoshiki / fixed_table_column_width_aligned_text_demo.tex
Created January 19, 2023 13:36 — forked from LanternD/fixed_table_column_width_aligned_text_demo.tex
LaTeX - Fixed table column width while aligning text left/center/right
\documentclass{article}
\usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\begin{document}
@maekawatoshiki
maekawatoshiki / float_arcade.md
Created November 13, 2022 15:35 — forked from CrockAgile/float_arcade.md
Floating Point Arcade

Floating Point Arcade

![Twitter Follow][twitter]

A Shady Coin Toss

A shady game master approaches...

Hey there! You look like you would enjoy a good game of chance.
; ModuleID = 'c.c'
source_filename = "c.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.termios = type { i32, i32, i32, i32, i8, [32 x i8], i32, i32 }
%struct.game = type { [4 x [4 x i32]] }
@.str = private unnamed_addr constant [28 x i8] c"--------------------------\0A\00", align 1
@.str.1 = private unnamed_addr constant [2 x i8] c"|\00", align 1
function AVLTree() {
this.kind = "empty";
this.depth = 0;
this.insert = function(val) {
if (this.kind == "empty") {
this.kind = "val";
this.val = val;
this.depth = 1;
} else if (this.kind == "val") {
@maekawatoshiki
maekawatoshiki / diff.md
Last active June 17, 2021 15:48
Difference
  • test.ll
; void test(int arr[10][10][10], int x) {
;   for (int k = 0; k < 10; k++) 
;     for (int j = 0; j < 10; j++) 
;       for (int i = 0; i < 10; i++) 
;         arr[i][k][j] += x * 2;
; }
@maekawatoshiki
maekawatoshiki / gep.md
Last active August 30, 2020 16:04
problem with gep

何がわからないのか

common subexpression elimination や loop invariant code motion を行うと, getelementptr が,本来含まれていた基本ブロックの外へと移動することがある.

一見問題なさそうだが,場合によっては生成される命令数が増える.(これは自作コンパイラ基盤の実装上の問題)

次のコードは,

diff --git a/library/std/src/sys/hermit/alloc.rs b/library/std/src/sys/hermit/alloc.rs
index d153914e77e..04446172197 100644
--- a/library/std/src/sys/hermit/alloc.rs
+++ b/library/std/src/sys/hermit/alloc.rs
@@ -1,3 +1,5 @@
+#![deny(unsafe_op_in_unsafe_fn)]
+
use crate::alloc::{GlobalAlloc, Layout, System};
use crate::ptr;
use crate::sys::hermit::abi;
package main
import (
"fmt"
"unicode"
"unicode/utf8"
)
type NodeKind int
#include <iostream>
#include <string>
#include <stack>
#include <memory>
#include <sstream>
class Node {
public:
virtual std::string to_string() = 0;
virtual double eval() = 0;