Posts

SIP call using linphone CLI and voipbuster

Purpose: make a SIP call to my phone in CLI. I used voipbuster as VOIP service provider. Solution: linphone CLI (command line) 1. install $ sudo apt install linphone-nogtk this will install linphone v3.12.0 (at the time of writing) 2. config 2.1. run command "linphonec"  (note the "c" at the end) $ linphonec 2.2. add voipbuster (red bold letters are input) linphonec> proxy add Adding new proxy setup. Hit ^D to abort. Enter proxy sip address: sip:XXX@voipbuster.com Your identity for this proxy: sip:XXX@voipbuster.com Do you want to register on this proxy (yes/no): yes Specify register expiration time in seconds (default is 600): <ENTER> Expiration: 600 seconds Specify route if needed: <ENTER> No route specified. -------------------------------------------- sip address: sip:XXX@voipbuster.com route: identity: sip:XXX@voipbuster.com register: yes expires: 600 registered: no -------------------------------------------- Accept the above proxy configuration...

X

 坐庄的原理 在大街上,有时可以看到一种玩38的临时赌局。一个人拿着一个小酒杯,酒杯里有一个白色的小片,小片的一面写着3,另一面写着8,他一面快速地在地上转着酒杯,一面口中念念有词,不外是解说规则招呼围观者下注。随着酒杯旋转,杯中的小片也跟着翻滚,转上一阵后,他突然用一块硬纸板把杯口盖上,周围的人开始压钱。由于小片一直在晃动,看清上面的字多少是有些困难的,所以有人压3有人压8。压完之后一开盖,压对的一赔一,压错的压多少全输掉。 这个游戏看似对压钱的人有利,因为只要眼力好,仔细看,就算不是每一次都能看准,至少能对多错少,只要看的仔细些,应该是只赢不输。但一玩就知道了,有时候看的清清楚楚是3,可一开盖却是8。玩的人只以为是自己没看清,于是更仔细的看,看清楚了再压,结果还是有时对有时错,等玩一段时间再看,肯定是输钱多赢钱少。 道理何在呢?原来在小片中夹有一小片磁铁,聚赌者手中拿着另一块磁铁。他悄悄的把磁铁N极S极往上一凑,要它是8就是8,要它是3就是3,和他玩的人有输没赢。 从这个例子包括了坐庄的基本原理。坐庄有两个要点,第一,庄家要下场直接参与竞局,也就是这样才能赢;第二,庄家还得有办法控制局面的发展,让自己稳操胜券。 股市做庄也是如此,股市做庄庄家要把仓位分成两部分,一部分用于建仓,部分资金的作用是直接参与竞局;另一部分用于控制股价。与38游戏不同,38游戏中靠作弊控制局面,而在股市中庄家必须通过实际买卖来控制股价;38游戏中用一块磁铁就可以控制局面了,完全没有成本,而股市中必须用一部分资金控盘,而且控盘这部分资金风险较大,一圈庄做下来,这部分资金获利很低甚至可能会赔,庄家赚钱主要还是要靠建仓资金。 股市控盘是有成本的,所以,要做庄必须进行成本核算,看控盘所投入的成本和建仓资金的获利相比如何,如果控盘成本超出了获利,则这个庄就不能再做下去了。一般来说,坐庄是必赢的,控盘成本肯定比获利少。因为做庄控盘虽然没有超越于市场之外的手段无成本的控制局面,但股市存在一些规律可以为庄家所利用,可以保证控盘成本比建仓获利要低。 控盘的依据是股价的运行具有非线形,快速集中大量的买卖可以使股价迅速涨跌,而缓慢的买卖即使量已经很大,对股价的影响仍然很小。只要市场的这种性质继续存在下去,庄家就可以利用这一点来获利。股价之所以会有这种运动规律,是因为市场上存在大量对行情缺乏分析判断能力...

kde ksshaskpass ssh-agent plasma

Kubuntu 20.04 LTS 0. keys. put keys in $HOME/key folder (optional) make sure private key files permission is 400 or 600. (required), and file extension is ".key". 1. install ksshaskpass (mine is installed) $ sudo apt install ksshaskpass 2. add keys $HOME/.config/autostart-scripts/load-keys.sh file content: #!/bin/bash export SSH_ASKPASS=/usr/bin/ksshaskpass SSH_ASKPASS=/usr/bin/ksshaskpass ssh-add ~/key/*.key </dev/null Run this script manually once. It will ask for password if key file is password-protected, and it can save the password in kwallet so you won't need to input it again. 3. make load-keys.sh executable $ chmod +x $HOME/.config/autostart-scripts/load-keys.sh 4. load ssh-agent (not required on mine) (make it executable too) $ cat ~/.config/plasma-workspace/env/ssh-agent-startup.sh #!/bin/bash [ -n "$SSH_AGENT_PID" ] || eval "$(ssh-agent -s)" Reference https://newbedev.com/using-ssh-agent-with-kde https://dev.to/manekenpix/kde-plasma-s...

Xbox one controller Linux rpcs3 PS3

1. install xpadneo driver/utilities $ sudo apt install dkms git linux-headers-`uname -r` $ git clone https://github.com/atar-axis/xpadneo.git $ cd xpadneo/ $ sudo ./install.sh  $ sudo apt install joystick $ sudo aptitude install jstest-gtk $ jstest-gtk  2. memlock setting add these two lines to /etc/security/limits.conf or /etc/security.conf, reboot. * hard memlock unlimited * soft memlock unlimited 3. download rpcs3 4. download PS3 firmware

DELL U4320Q ddccontrol in Linux switch input

Device i2c number $ sudo ddccontrol -p | grep /dev/  - Device: dev:/dev/i2c-8 this is the device i2c number. switch input source $ sudo ddccontrol -r 0x60 -w 4883 dev:/dev/i2c-8 -r 0x60: this is the input source switch. 4883: target port. DP1  15 or 4879 DP2  16 or 4883 HDMI1  17 or 4881 HDMI2  18 or 4882 USB-C 4891 read current value $ sudo ddccontrol -r 0x60 dev:dev/i2c-8 you can get the current value this way, if you have a different monitor model. Reference https://github.com/ddccontrol/ddccontrol-db/blob/master/doc/how-to-add-a-monitor.md https://askubuntu.com/questions/860761/ubuntu-command-line-to-change-input-source-on-a-display-monitor

UEFI boot.

GPT: GUID分区表。 ESP: EFI System Partition. It is the place where UEFI will look for a boot loader. 一个专用分区,UEFI 会从这类分区搜索boot loader。 NVRAM: 是BIOS ROM中的一段区域,一般定义为64k byte, 现在EFI把所有的变量都存在这里。 boot loader: 启动引导器。让机器知道真正的要启动的系统所在。GRUB (grubx64.efi),Windows (bootmgfw.efi),SYSLINUX (syslinux.efi),都属于boot loader。 /EFI/Boot/bootx64.efi: UEFI fallback boot loader path,默认引导器路径。完整路径是\EFI\BOOT\BOOT{machine type short-name}.efi。当计算机没有引导条目或已存条目均无效时,尝试加载此文件。LiveCD和安装盘等就会用到这个文件。本文件其实就是grubx64.efi或者bootmgfw.efi,区别就是默认和指定的。 efibootmgr/Bcdedit: manipulate the UEFI Boot Manager。 创建和修改引导条目,保存在NVRAM。一般用于永久安装的系统,如安装好的Windows 10,而非安装盘或者LiveCD系统等。 常用路径 \EFI\boot\bootx64.efi \EFI\Miscosoft\Boot\bootmgfw.efi \EFI\Ubuntu\grubx64.efi \EFI\Ubuntu\shimx64.efi (secure boot) 查看NVRAM引导设置的命令: Linux: sudo efibootmgr -v Win10: bcdedit /enum firmware 参考: https://www.jianshu.com/p/a35d42daf010 https://www.happyassassin.net/posts/2014/01/25/uefi-boot-how-does-that-actually-work-then/ https://wiki.syslinux.org/wiki/index.php?...

Organize my music files.

FLAC to ALAC: $ ffmpeg -y -i source.flac -acodec alac -vcodec copy dest.m4a APE to ALAC: $ ffmpeg -y -i source.ape -acodec alac -vcodec copy dest.m4a cut using CUE $ ffcuesplit.py album.cue .py file is in https://gist.github.com/frabad/5e4505b9f6e6c0ffb29e4fdb5a05c76e ReplayGain $ rgbpm2 folder1 executables are in this git repo:  https://github.com/Moonbase59/loudgain

Nginx in Docker, IPv6 with routed prefix.

I don't want to waste my IPv6 routed prefix. Some background story first. I applied for an IPv6 tunnel broker and they assigned me a /64 routed prefix ( read the post ). How to use it? Of course, docker containers. So I grab the nginx image and run containers with IPv6 support, access with public v6 IP or a domain name. The question remains: Why do we still use IPv4??? HOW-TO In the docker documentation, it recommends creating new networks instead of using those default ones (bridge/host/none). So I follow the instruction and create a bridge network for my IPv6 routed prefix.  0. IP Forwarding Note, IP forwading is required, and you can enable it by (with root!) # echo 1 > /proc/sys/net/ipv6/conf/all/forwarding  1. Create docker network. 2001:db8:1f19:242::/64 is the routed prefix I want to use with docker and I named the network nginxipv6. $ docker network create  -d bridge --ipv6 nginxipv6 \         --subnet "2001:db8:1f19:242::/64" \   ...

IPv6 over IPv4 in an OpenVZ VPS, using Tunnel Broker.

IPv4 only OpenVZ VPS, how to gain access to IPv6? Short answer: Tunnel! I use  TunnelBroker . TunnelBroker generously provides 5 free tunnels. I have an VPS with only public IPv4 addresses, but I would like to access another VPS with only IPv6 address. So we need some help here, a proxy that encapsulates IPv6 data in an existing IPv4 connections and transfer it to a host which has both IPv4 and IPv6, and process the IPv6 request in that host, and return the result. PS. The client has to be able to process IPv6, e.g. set up an IPv6 address. Architect This setup requires a host with public IPv4+IPv6 and I will name the host 'tunnel server' afterwards. The client host and the tunnel server are connected via an IPv4 tunnel. All IPv6 data will be encapsulated in IPv4 packets and transferred through this tunnel. The tunnel server receives and  de-encapsulates the IPv4 packet, gets the IPv6 request, processes it and get the result, encapsulates in IPv4 and transfers the result b...

How to pull docker image in a pure IPv6 host?

Docker Hub does NOT support IPv6!!!!! In Dec 2020, docker hub only supports IPv4, and that's sad! $ docker pull nginx Using default tag: latest Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp 52.4.20.24:443: connect: network is unreachable But I need to pull images from docker hub, what should I do? Proxy! Yes, all we need is a HTTP proxy. Basically, I setup a HTTP proxy in another DUAL stack host (a host with both IPv4&IPv6), and ask the docker to use it. HOW-TO 1. install proxy I use goproxy . Download, extract, start proxy. By default, it listens on 33080. $ ./proxy http --debug --debug is for verbose information, drop it if everything goes well. 2. tell docker to use the proxy $ sudo systemctl edit docker.service and add the following to the file.. [Service] Environment="HTTP_PROXY=http://[Dualstack_IPv6]:33080" Environment="HTTPS_PROXY=https://[Dualstack_IPv6]:33080" # reload to read the changes $ sudo systemctl daemon-reload ...

rsync to DSM results "Permission denied, please try again."

Can't rsync to DSM! $ rsync -avz mystuff admin@onehost.onedomain.org:/volume1/MyShare/ Permission denied, please try again. rsync error: rsync service is no running (code 43) at io.c(687) [sender=3.0.9] Even ssh will result an error: $ ssh admin@onehost.onedomain.org rsync Permission denied, please try again. Solution $ rsync -avz -e ssh --rsync-path=/usr/bin/rsync \        mystuff admin@onehost.onedomain.org:/volume1/MyShare/ The --rsync parameter is the key. Older versions of DSM, rsync resides in /usr/syno/bin/, so use  --rsync-path=/usr/syno/bin/rsync instead.

Better SSH key management.

SSH is good, but too many KEYS! Once the number of servers you have to manage reaches 5 or more, SSH keys will become a mess. Do I need to generate a new key pair for every machine? I don't want to upload keypairs to every server, and rotating them takes ages. This also imposes security threats.  Overhaul, here are some ideas. We need a big change. Here are goals I wish to achieve. Only ONE key and that's enough!  No key pairs on each server due to security concerns. Able to ssh back and forth between servers, no password required. Able to access GitHub/GitLab repositories with the same SSH key. WinSCP can access servers without a password. I will also cover the setup for Synology DSM, OpenWRT (dropbear). What do we need? Windows Linux Key Generation ssh-keygen, puttygen ssh-keygen PPK format puttygen Agent ssh-agent, pageant ssh-agent Client Putty, WinSCP ssh, scp For Linux, these usually come with distribution. For Windows clients, please install Git for Windows and downloa...

Change hostname and container name in Synology Docker

I am not able to change hostname! Yes, you can change the name of the container, but that's it, no useful. Even the command hostname  fails. You are stuck with the initial name when you created the container. Sad.... What's required? Yes, here is the solution and it requires shell access with root privilege . You may SSH to the box with admin and sudo root. Four steps locate container ID and content directory shutdown Docker service manually change them in config files start Docker service Once again, with root! 0. Change the container name in web UI console first if necessary. 1.  # docker ps -a Find the container ID in the 1st column. # docker inspect <container_id> | grep Path You will see the file path, a very long one, like this one, the blue part is the directory.         "HostnamePath": " /volume1/@docker/containers/0fbc2a4f6caf4f9337ds82e6dc57857514490a459e28054c1f616e2a9742bb35/ hostname", cd to that directory. 2. # synpkgctl stop Docker stop...