Skip to content

Instantly share code, notes, and snippets.

set BAT=%~0
@if "%1"=="R" (
FOR /F "tokens=3 usebackq" %%i in (`netstat -rn ^|findstr /R "\<0\.0\.0\.0" ^|findstr 172`) do (
echo the IP is %%i
route delete 0.0.0.0 mask 0.0.0.0 %%i
route add 172.16.0.0 mask 255.240.0.0 %%i
goto exit_for
)
@akirayou
akirayou / vpnc-script.js
Created August 17, 2021 01:21
override SISCT_SPLIT setting environ ment
//
// vpnc-script-win.js
//
// Sets up the Network interface and the routes
// needed by vpnc.
//
// --------------------------------------------------------------
// Initial setup
// --------------------------------------------------------------
from scapy.all import *
def r(a):
if(a[3].qd is None or 1 != a[3].qd.qtype ):return
print(a[3].qd.qname.decode('utf-8'))
sniff(filter="udp and port 5353",prn=r,count=10000)
from scapy.all import *
def r(a):
if(a[3].qd is None):return
if( not 1 == a[3].qd.qtype):return
qname=a[3].qd.qname
print(qname.decode('utf-8'))
an=DNSRR(rrname=qname,type="A",rclass=0x8001,rdata="192.168.1.107",ttl=120)
d=DNS(id=0,qr=1,aa=1,ancount=1,rd=0,an=an)
print(d)
send(IP(dst="224.0.0.251",ttl=255)/UDP(dport=5353, sport=5353)/d)
@akirayou
akirayou / DNG.py
Last active February 3, 2023 00:18
# -*- coding: utf-8 -*-
"""
Created on Sun May 9 20:45:45 2021
@author: youak
"""
import glob
files=glob.glob("*.DNG")
is_rig_cam=True #meshroom では depth推定できないような配置のrigカメラは逆効果っぽい(dence画像作成時にコケる)
from cmdstanpy import CmdStanModel
import os
with open("test.stan","w") as f:
print("""
data {
}
parameters {
real A;
}
model {
# -*- coding: utf-8 -*-
"""
Example implimentation for YDLIDAR X4
"""
#pip install pyserial-asyncio
import serial_asyncio
import asyncio
import time
#spyderとかipython環境で使うときはシステムですでにasyncio使ってて喧嘩するので
# -*- coding: utf-8 -*-
"""
Example implimentation for YDLIDAR X4
"""
#pip install pyserial-asyncio
import serial_asyncio
import asyncio
import time
#spyderとかipython環境で使うときはシステムですでにasyncio使ってて喧嘩するので
"""
isotherm functions
See: https://www.jstage.jst.go.jp/article/oleoscience/2/5/2_275/_pdf
Important variables
C:濃度
W:吸着量
S=W+C
"""
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import asyncio
import nest_asyncio
nest_asyncio.apply()
loop = asyncio.get_event_loop()