Skip to content

Instantly share code, notes, and snippets.

View cvcore's full-sized avatar
🍀
🎼🎏

Cheng cvcore

🍀
🎼🎏
View GitHub Profile
@cvcore
cvcore / README.md
Last active January 13, 2024 15:18
Send Voicemail from Asterisk with Telegram Bot

Forward Voicemail from Asterisk with Telegram Bot

Installation

First, put the script to a common location e.g. /usr/local/bin/vm-post.py

Then, point your Asterisk mail command to this script to invoke it when a voice mail is received.

The script will decode the text message (as configured from Asterisk) and the voice message (stored with wav encoding).

@cvcore
cvcore / download_vscode_server.sh
Last active December 14, 2023 20:50
Manual download vscode-server
#!/bin/bash
# This script downloads and installs a specific version of VSCode Server for Linux.
# The version is specified by the first argument to the script.
# You can find the git commit id in the output of Remote - SSH plugin in VSCode.
# The output looks like this:
# ...
# Using commit id "af28b32d7e553898b2a91af498b1fb666fdebe0c" and quality "stable" for server
# ...
@cvcore
cvcore / colorize-emacs.bashsource
Created May 1, 2022 08:32 — forked from algal/colorize-emacs.bashsource
Setting up truecolor (24 bit color) in emacs in the terminal, under iTerm2, blink.sh, and others.
# sourcing this file will define a bash functions that
# tries to run subsequent calls to emacs with 24 bit color.
#
# It sets TERM=xterm-emacs-leg if
# - we've created a user-local terminfo record for xterm-emacs-leg, and
# - we're using iTerm2 or something has set COLORTERM=truecolor
#
# This will cause emacs to use 24 bit color only when it will work,
# inside or outside of tmux. I haven't found a way to auto-detect Blink.sh yet.
#
@cvcore
cvcore / org-fragment-auto-preview.el
Last active May 30, 2020 18:33
Automatic fragment toggling in org-mode
;;
;; 28.07.2017
;; Charles Wang
;;
;;;;;;; Tweaks for Org & org-latex ;;;;;;
(defvar cw/org-last-fragment nil
"Holds the type and position of last valid fragment we were on. Format: (FRAGMENT_TYPE FRAGMENT_POINT_BEGIN)"
)
@cvcore
cvcore / px2_ros_install.sh
Last active September 14, 2018 01:41
NVIDIA Drive PX 2 ROS Installation
#!/bin/bash
# taken from https://devtalk.nvidia.com/default/topic/1011002/cross-compiling-driveworks-on-the-px2-with-ros/
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
# sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo sh -c 'echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
# this is crucial
sudo apt-get install libssl1.0.0/xenial libssl-doc/xenial libssl-dev/xenial
@cvcore
cvcore / custom-vpn.service
Created June 29, 2018 10:57
Custom VPN systemd unit (place under /etc/systemd/system/custom-vpn.service)
[Unit]
Description=Custom VPN
After=network.target auditd.service
[Service]
Type=forking
ExecStart=/opt/scripts/vpn_dns_update.sh daemon
ExecStop=/opt/scripts/vpn_dns_update.sh daemon-kill
PIDFile=/var/run/momenta-vpn.pid
RemainAfterExit=True
@cvcore
cvcore / vpn_dns_update.sh
Created June 29, 2018 10:55
Automatic openconnect VPN connection
#!/bin/bash
# needs to run as root
# THIS SAMPLE CODE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PAGERDUTY OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) SUSTAINED BY YOU OR A THIRD PARTY, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ARISING IN ANY WAY OUT OF THE USE OF THIS SAMPLE CODE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Configurations
VPN_USER=
VPN_PWD=
VPN_SERVER=
HOSTNAME=
@cvcore
cvcore / px2_git_lfs.sh
Last active June 20, 2018 10:26
install git lfs on PX2 (aarch64)
#!/bin/bash
# install go
mkdir -p ~/Downloads && cd ~/Downloads
wget https://dl.google.com/go/go1.9.4.linux-arm64.tar.gz
sudo tar -C /usr/local -xzf go1.9.4.linux-arm64.tar.gz
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
source ~/.bashrc
# install git-lfs