Skip to content

Instantly share code, notes, and snippets.

View sonsongithub's full-sized avatar

Yuichi Yoshida sonsongithub

View GitHub Profile
@sonsongithub
sonsongithub / test.swift
Created February 17, 2022 13:19
swift concurrency
actor Flag {
var value = false
func free() {
value = false
}
func check() -> Bool {
if value == false {
value = true
return false
class A:
def __init__(self, name):
self.name = name
def doit(self):
print(self.name + " doit by class A")
def dodo(self):
self.doit()
@sonsongithub
sonsongithub / test_a.py
Created October 25, 2021 03:34
where is a...?
def hoge(**kwargs):
print(a)
print(kwargs)
a = 10
arg = {}
arg['a'] = 20
hoge(**arg)
// 接線の傾き
fn get_a(x:&f32) -> f32 {
return 3.0 * x * x + 2.0 * x + 2.0;
}
// 接線の切片
fn get_b(x:&f32, n: &f32) -> f32 {
return x * x * x + x * x + 2.0 * x + (3.0 - n) - x * get_a(x);
}
@sonsongithub
sonsongithub / ContentView.swift
Created August 11, 2020 15:26
Try to start download image according to scrolling the list.
//
// ContentView.swift
// testswiftui
//
// Created by sonson on 2020/08/07.
//
import SwiftUI
import UIKit
@sonsongithub
sonsongithub / ans_binary.py
Created May 19, 2020 08:52
Asymmetric numeral system for compression
import numpy as np
x_init = 1
x = x_init
q = 0.6
x_history = [x]
data_stream = [0, 1, 1, 1, 0, 0, 0, 1]
proxy eth0 {
router no
timeout 500
autowire yes
keepalive yes
retries 3
ttl 30000
rule ::/0 {
iface switch0.10
}
#!/bin/vbash
# copy to this file into
# /config/scripts/post-config.d
/ndppd/local/sbin/ndppd.initscript start
@sonsongithub
sonsongithub / ndppd.initscript
Created March 24, 2020 01:33
ndppd run script for EdgeMax
#!/bin/sh
# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
fi
### BEGIN INIT INFO
# Provides: ndppd
# Required-Start: $remote_fs $syslog $network
# Required-Stop: $remote_fs $syslog $network
@sonsongithub
sonsongithub / c_cpp_properties.json
Created February 25, 2020 09:46
c_cpp_properties.json for Visual studio code for llvm development.
{
"configurations": [
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/**",
"/usr/local/opt/llvm/include/"
],
"defines": [],
"macFrameworkPath": [