Skip to content

Instantly share code, notes, and snippets.

View yskszk63's full-sized avatar
🗾
I'm here.

yusuke suzuki yskszk63

🗾
I'm here.
  • Tokyo, Japan
  • 02:34 (UTC +09:00)
  • X @yskszk63
View GitHub Profile
@yskszk63
yskszk63 / main.rs
Created January 13, 2022 12:36
errno & dlopen
use std::os::raw::{c_int, c_char};
use std::ffi::{CStr, CString, c_void};
use std::ptr::null;
use std::thread::spawn;
const RTLD_LAZY: c_int = 0x00001;
extern "C" {
fn dlopen(filename: *const c_char, flag: c_int) -> *const c_void;
fn dlclose(handle: *const c_void) -> c_int;
@yskszk63
yskszk63 / Makefile
Created September 17, 2021 14:02
clang wasm stack allocate
CC = clang
CFLAGS = --target=wasm32-wasi --sysroot=/opt/wasi-sdk/wasi-sysroot -nostartfiles -Wl,--no-entry
.PHONY: all
all: run
.PHONY: run
run: a.mod.wasm
deno run --allow-read $(CURDIR)/run.ts
@yskszk63
yskszk63 / output.txt
Created September 14, 2021 11:08
js TextEncoder.prototype.encodeInto test
0 0 0 Uint8Array(0) []
1 0 0 Uint8Array(0) []
2 0 0 Uint8Array(0) []
3 0 0 Uint8Array(0) []
4 2 4 Uint8Array(4) [ 240, 159, 146, 169 ] 💩
5 3 5 Uint8Array(5) [ 240, 159, 146, 169, 97 ] 💩a
6 3 5 Uint8Array(5) [ 240, 159, 146, 169, 97 ] 💩a
7 3 5 Uint8Array(5) [ 240, 159, 146, 169, 97 ] 💩a
8 4 8 Uint8Array(8) [ 240, 159, 146, 169, 97, 230, 151, 165 ] 💩a日
9 4 8 Uint8Array(8) [ 240, 159, 146, 169, 97, 230, 151, 165 ] 💩a日
@yskszk63
yskszk63 / httpd.conf
Created August 18, 2021 02:02
Git - Smart HTTP requires auth always.
# ...
# https://git-scm.com/book/ja/v2/Git%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC-Smart-HTTP
SetEnv GIT_PROJECT_ROOT /opt/git
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git/ /usr/lib/git-core/git-http-backend/
#RewriteEngine On
#RewriteCond %{QUERY_STRING} service=git-receive-pack [OR]
#RewriteCond %{REQUEST_URI} /git-receive-pack$
#RewriteRule ^/git/ - [E=AUTHREQUIRED]
@yskszk63
yskszk63 / Main.java
Created June 6, 2021 01:30
forking Java process with panama-foreign
import java.lang.invoke.MethodType;
import jdk.incubator.foreign.CLinker;
import jdk.incubator.foreign.FunctionDescriptor;
import jdk.incubator.foreign.LibraryLookup;
import jdk.incubator.foreign.MemoryAddress;
// run with `java --add-modules jdk.incubator.foreign -Dforeign.restricted=permit Main.java`
//
// TODO
@yskszk63
yskszk63 / Echo.java
Created June 4, 2021 12:50
Simple Java http echo server
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer;
public class Echo implements HttpHandler {
@yskszk63
yskszk63 / Cargo.toml
Created May 13, 2021 12:16
pipeterminal
[package]
name = "pipeterminal"
version = "0.1.0"
authors = ["yskszk63 <yskszk63@gmail.com>"]
edition = "2018"
license = "MIT or Apache-2.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

Vim :s

自分向けのメモ

テキストを削除

%s/GATT Characteristic and Object Type//g
%s/GATT Service//g
@yskszk63
yskszk63 / output.txt
Created January 24, 2020 11:14
Hello StartTLS
220 SG ESMTP service ready at ismtpd0008p1hnd1.sendgrid.net
[EHLO]
250-smtp.sendgrid.net
250-8BITMIME
250-PIPELINING
250-SIZE 31457280
250-STARTTLS
250-AUTH PLAIN LOGIN
250 AUTH=PLAIN LOGIN
@yskszk63
yskszk63 / sendgrid-test.py
Created July 16, 2019 05:55
SendGrid Test by python smtplib
#!/usr/bin/env python3
import os
from smtplib import SMTP
from email.message import EmailMessage
def main():
api_key = os.environ['api_key']
# my addr -> spam, 'uso@dummy.ko' -> not spam