Skip to content

Instantly share code, notes, and snippets.

Avatar
🔰
take it easy

Leonardone @ NEETSDKASU neetsdkasu

🔰
take it easy
View GitHub Profile
@neetsdkasu
neetsdkasu / go.mod
Last active May 2, 2022
ファイル(*.*)を 30 個ずつ連番ディレクトリ(dir???)に分けるだけ
View go.mod
module division
go 1.18
@neetsdkasu
neetsdkasu / main.rs
Last active Apr 19, 2022
DNSクエリ見てみる
View main.rs
// ネットワークアダプタの設定で
// 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 Nov 28, 2021
CodeMirrorでCASL2の色付け・・・
View casl2.js
// 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 Jul 10, 2021
素数とか(雑)
View primes.hs
-- 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
View modulo.hs
-- 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 Jul 10, 2021
ModValue (雑)
View modular.rs
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 Feb 6, 2021
ファイルをバイナリファイルとして開いてbyte値をカンマ区切りで表示するだけ
View main.go
package main
import (
"fmt"
"io/ioutil"
"os"
)
func usage() {
fmt.Println(os.Args[0], "[-s] <filename>")
@neetsdkasu
neetsdkasu / main.go
Last active Nov 20, 2020
一時ファイルをnotepad.exeに渡してから読み込む
View main.go
package main
import (
"bytes"
"encoding/binary"
"io/ioutil"
"log"
"os"
"os/exec"
"unicode/utf16"
@neetsdkasu
neetsdkasu / Flag.fs
Last active Jul 22, 2020
JSONの構造解析 (JsonAnalyzer.fs)
View Flag.fs
//
// JsonAnalyzer
// - Flag module
//
// parse Command-line Arguments
//
module Flag
let showUsage() =
@neetsdkasu
neetsdkasu / main.go
Last active May 30, 2019
CodinGame A Code of Ice & Fire (io part of my bot)
View main.go
package main
import (
"fmt"
"os"
)
func main() {
game := NewGame()
for {