Skip to content

Instantly share code, notes, and snippets.

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"SoS test"
]
},
{
@xunzhou
xunzhou / telegram.sh
Created July 16, 2018 01:48
Send Message to Telegram Bot
#!/bin/bash
bot_key="<API Token from BotFather>"
# Need to send a message to your bot in order to see chat_id.
chat_id="<chat_id from https://api.telegram.org/bot<bot_key>/getUpdates>"
response=$(curl -s "https://api.telegram.org/bot$bot_key/sendMessage?chat_id=$chat_id&text=$@")
status=$(echo $response | cut -d ':' -f2 | cut -d ',' -f1)
echo "Sent: $status"
@xunzhou
xunzhou / trans.py
Last active March 2, 2022 06:32
Translate Onetab txt export → Keptab json import
import time, json
from urllib.parse import urlparse, urlunparse
class tab:
def __init__(self, url, title):
self.url = url; self.title = title
self.favIconUrl = urlunparse(urlparse(url)._replace(path='favicon.ico',params='',query='',fragment=''))
self.pinned = False; self.muted = False
_id, res, tabs, urls = int(time.time() * 1000), [], [], []
@xunzhou
xunzhou / screenshot.sh
Created July 22, 2023 19:06
screenshot at T-3
#!/bin/bash
OLD_IFS=$IFS
IFS=$'\0'
for i in *.webm; do
T=$(ffprobe -i $i -show_format -v quiet | sed -n 's/duration=//p' | awk -F. '{print $1-3}')
ffmpeg -i $i -ss $T -vframes 1 output/"${i%.*}.png"
done