Skip to content

Instantly share code, notes, and snippets.

Avatar

Malcolm Ke Win diyism

View GitHub Profile
@diyism
diyism / google cloud shell vps
Last active Oct 27, 2020
google cloud shell vps
View google cloud shell vps
#go to https://shell.cloud.google.com/
#in Terminal(bottom half page) or Cloud Shell tab in IDE(top half page):
wget https://pkgs.tailscale.com/stable/tailscale_1.0.5_amd64.tgz
tar zxvf tailscale_1.0.5_amd64.tgz
mkdir tailscale
cp tailscale_1.0.5_amd64/tailscaled tailscale/
cp tailscale_1.0.5_amd64/tailscale tailscale/
rm -rf tailscale_1.0.5_amd64
rm tailscale_1.0.5_amd64.tgz
nano .customize_environment
@diyism
diyism / pair android tablet bluetooth keyboard with remote linux pc or server
Last active Oct 4, 2020
pair android tablet bluetooth keyboard with remote linux pc or server
View pair android tablet bluetooth keyboard with remote linux pc or server
先从平板上用ConnecBot或Admin Hands应用登录远端linux pc或数据中心的linux server, 执行下面这些命令:
sudo systemctl start tailscaled
sudo tailscale up
sudo vhclient64 #启动virtualhere客户端的守候进程, 不能用"sudo vhclient64 -n"会要求付费才能执行vhclient64 -t use时不failed
sudo vhclient64 -t "manual hub add,平板的tailscale ip地址" #用virtualhere命令添加usbip服务端并连接, 这个服务端指的是提供usb设备的机器比如平板
sudo vhclient64 -t "manual hub list" #列出所有usbip服务端
sudo vhclient64 -t "auto use hub,平板的tailscale ip地址" #连接usbip服务端
sudo vhclient64 -t list #列出服务端可远程传送的设备,
@diyism
diyism / smartest json parser.txt
Last active Aug 24, 2020
smartest json parser
View smartest json parser.txt
最小的json parser使用递归逻辑也要100到200行代码:
https://github.com/no1msd/json.hpp/blob/master/include/json.hpp
https://www.jianshu.com/p/d5eee50c5e24
有没有更巧妙的办法呢? smartest dirty json parser 体现程序员"分形复用"的思维而不要去写if else switch:
类似于:
<?php
$json='{"a":{"b":"c", "k":"jack"},"d":"peter", "x": 1, "t": {"bb":"c", "kk":"jack"}}';
@diyism
diyism / 用android-keyboard-gadget和magisk root让nexus 6p变成真正的usb键盘.txt
Last active Jul 31, 2020
用android-keyboard-gadget和magisk root让nexus 6p变成真正的usb键盘
View 用android-keyboard-gadget和magisk root让nexus 6p变成真正的usb键盘.txt
#https://github.com/pelya/android-keyboard-gadget
#重启到bootloader/fastboot:
adb devices
adb reboot bootloader
sudo ./fastboot devices
#先在系统配置developer里allow unlock, 然后再unlock:
sudo ./fastboot flashing unlock
View armbian DE.txt
https://www.armbian.com/pine64/
download Bionic server 5.4 : https://dl.armbian.com/pine64/Bionic_current
对应ubuntu bionic是ubuntu 18.04(cat /etc/os-release), 对应debian buster是debian 10(cat /etc/debian_version)
use etcher to burn image into sd card, boot pine64
login with root:1234, and modify root password and create a normal user
sudo apt install xserver-xorg lightdm lightdm-gtk-greeter xfce4 #sudo apt install lightdm lightdm-gtk-greeter lxde
sudo vi /etc/lightdm/lightdm.conf
#[Seat:*]
@diyism
diyism / Use your android phone as a karaoke microphone in Linux.md
Last active Jan 7, 2021
Use your android phone as a karaoke microphone in Linux
View Use your android phone as a karaoke microphone in Linux.md

micclient+WoMic is close source, while Mumble is open source, so on armbian tv, I can only use Mumble+Murmurd+Plumble.

===================="mumble+murmurd"(on arm64 armbian linux tv)+plumble(on android/ios)==================== refer: https://github.com/diyism/mic_over_mumble

sudo apt install mumble mumble-server

sudo systemctl stop mumble-server.service

@diyism
diyism / firefox chrome speak chinese.htm
Last active May 17, 2020
firefox chrome speak chinese
View firefox chrome speak chinese.htm
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>firefox/chrome speak chinese</title>
</head>
<body>
<script>
@diyism
diyism / udp traffic forwording with swoole udp server or swoole udp client.php
Created Jan 7, 2020
udp traffic forwording with swoole udp server or swoole udp client
View udp traffic forwording with swoole udp server or swoole udp client.php
<?php
$ch='';
$udp_server=new swoole_server('0.0.0.0', 21414, SWOOLE_BASE, SWOOLE_UDP);
$udp_server->on('packet', function ($ipsock, $data, $ipsock_con) /* use(&$ch) */
{
//echo $data."=========sent====\n\n";
if ($ipsock_con['port']!=21406)
{
$ipsock->sendto('127.0.0.1', 21406, $data); //to wg
@diyism
diyism / create multiple servers with php swoole.php
Created Dec 6, 2019
create multiple servers with php swoole
View create multiple servers with php swoole.php
<?php
/*
open two udp servers and two tcp servers simultaneously with swoole
to test them from linux shell:
$nc -u 127.0.0.1 21404
helloooo_udp
helloooo_udp
...
@diyism
diyism / auto connect between bt300 glasses and linux pc through usb cable for vnc.txt
Last active Jun 26, 2020
auto connect between bt300 glasses and linux pc through usb cable for desktop VNC
View auto connect between bt300 glasses and linux pc through usb cable for vnc.txt
1.===============================/etc/udev/rules.d/70-adb.rules:
SUBSYSTEM=="usb", ATTR{idVendor}=="8087", ATTR{idProduct}=="0a63", GROUP="plugdev", MODE="0666"
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee7", GROUP="plugdev", MODE="0666"
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee4", GROUP="plugdev", MODE="0666"
SUBSYSTEM=="usb", ATTR{idVendor}=="8087", ATTR{idProduct}=="0a63", ACTION=="add", RUN+="/sbin/ifconfig usb0 192.168.42.1 up"
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee4", ACTION=="add", RUN+="/sbin/ifconfig usb0 192.168.42.1 up"
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee7", ACTION=="add", RUN+="/usr/bin/rehtet"
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="5208", GROUP="plugdev", MODE="0666"
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="5208", ACTION=="add", RUN+="/usr/bin/rehtet"