Skip to content

Instantly share code, notes, and snippets.

View neetsdkasu's full-sized avatar
🔰
take it easy

Leonardone @ NEETSDKASU neetsdkasu

🔰
take it easy
View GitHub Profile
@neetsdkasu
neetsdkasu / go.mod
Last active May 2, 2022 16:32
ファイル(*.*)を 30 個ずつ連番ディレクトリ(dir???)に分けるだけ
module division
go 1.18
@neetsdkasu
neetsdkasu / main.rs
Last active April 19, 2022 16:37
DNSクエリ見てみる
// ネットワークアダプタの設定で
// DNSのIPを127.7.7.7に設定してPC内からのDNSクエリを盗み見る
// nslookup example.com 127.7.7.7 とかで動くかテストしながら開発
fn main() -> std::io::Result<()> {
eprintln!("START");
let mut bufs = Bufs::new();
let res = bufs.start();
@neetsdkasu
neetsdkasu / casl2.js
Last active November 28, 2021 17:29
CodeMirrorでCASL2の色付け・・・
// CodeMirror mode CASL2
// author: Leonardone @ NEETSDKASU
CodeMirror.defineMode("casl2", function(conf, parserConf) {
"use strict";
const COMET2CMD = "keyword";
const CASL2CMD = "builtin";
const LABEL = "variable";
const REGISTER = "atom";
@neetsdkasu
neetsdkasu / primes.hs
Last active July 10, 2021 22:07
素数とか(雑)
-- author: Leonardone @ NEETSDKASU
isPrime :: Int -> Bool; primes :: [Int]
isPrime n = all (\e -> mod n e /= 0) $ takeWhile ((<=n).(^2)) primes
primes = 2 : 3 : filter isPrime os
where
os = zipWith (+) vs es
vs = 6 : 6 : map (+6) vs
@neetsdkasu
neetsdkasu / modulo.hs
Created July 1, 2021 17:05
ModValue (雑)
-- author: Leonardone @ NEETSDKASU
-- modvalue MUST BE PRIME!
modvalue :: Integral a => a
modvalue = 10^9 + 7
(+%),(-%),(*%),(/%) :: Integral a => a -> a -> a
a +% b = (a+b) `mod` modvalue
a -% b = a +% (modvalue - b)
a *% b = (a*b) `mod` modvalue
@neetsdkasu
neetsdkasu / modular.rs
Last active July 10, 2021 21:43
ModValue (雑)
mod modular {
// author: Leonardone @ NEETSDKASU
// modulo for ModValue
pub const MODULO: i64 = 1_000_000_007;
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
pub struct ModValue {
value: i64,
}
@neetsdkasu
neetsdkasu / main.go
Last active February 6, 2021 19:02
ファイルをバイナリファイルとして開いてbyte値をカンマ区切りで表示するだけ
package main
import (
"fmt"
"io/ioutil"
"os"
)
func usage() {
fmt.Println(os.Args[0], "[-s] <filename>")
@neetsdkasu
neetsdkasu / main.go
Last active November 20, 2020 09:52
一時ファイルをnotepad.exeに渡してから読み込む
package main
import (
"bytes"
"encoding/binary"
"io/ioutil"
"log"
"os"
"os/exec"
"unicode/utf16"
@neetsdkasu
neetsdkasu / Flag.fs
Last active July 22, 2020 12:55
JSONの構造解析 (JsonAnalyzer.fs)
//
// JsonAnalyzer
// - Flag module
//
// parse Command-line Arguments
//
module Flag
let showUsage() =
@neetsdkasu
neetsdkasu / main.go
Last active May 30, 2019 22:33
CodinGame A Code of Ice & Fire (io part of my bot)
package main
import (
"fmt"
"os"
)
func main() {
game := NewGame()
for {