Pank: October 2015 Archives

網段計算工具 netmask (備用載點)
很好用!

# netmask --help
This is netmask, an address netmask generation utility
Usage: netmask spec [spec ...]
-h, --help Print a summary of the options
-v, --version Print the version number
-d, --debug Print status/progress information
-s, --standard Output address/netmask pairs
-c, --cidr Output CIDR format address lists
-i, --cisco Output Cisco style address lists
-r, --range Output ip address ranges
-x, --hex Output address/netmask pairs in hex
-o, --octal Output address/netmask pairs in octal
-b, --binary Output address/netmask pairs in binary
-n, --nodns Disable DNS lookups for addresses
Definitions:
a spec can be any of:
address
address:address
address:+address
address/mask
an address can be any of:
N decimal number
0N octal number
0xN hex number
N.N.N.N dotted quad
hostname dns domain name
a mask is the number of bits set to one from the left
# netmask -r 192.168.0.0/28
192.168.0.0-192.168.0.15 (16)
# netmask -s 192.168.0.0/28
192.168.0.0/255.255.255.240

ImageMagick transparent watermark

user-pic
Vote 0 Votes

Example:
convert -resize 800x600 -quality 80% -strip -interlace Plane -pointsize 150 -font Tahoma -draw "gravity center fill RGBA(200,200,200,0.3) text 0,0 'WATERMARK'" source.jpg output.jpg

Replace WATERMARK with your text
RGBA, A is alpha channel, a number between 0.0 (fully transparent) and 1.0 (fully opaque)

Telegram

user-pic
Vote 0 Votes

Telegram 這一套即時通訊軟體, 在台灣似乎很少人知道, 用的人更少.
它的 Client 端是 Open Source, Server 端是私有軟體,
Client 端可以多重登入, 訊息也同步, 比 LINE 強, 只是功能沒那麼多, 介面比較簡單一點.
有各種平台的 Apps, 最棒的是有提供 API
他的 API 有兩種, Bot API 及 Telegram API , 若只是要發訊息用第一種即可.

Bot API 使用摘要:
在 Search 輸入 BotFather, 加入他, 跟他對話, 輸入 /newbot
他會問你 Bot name 及 Bot username, 然後會給你一組 token, 可用來發訊息
API 網址 https://api.telegram.org/bot<token>/METHOD_NAME
支援 GET, POST
METHOD_NAME 在這一頁都有說明
傳訊息需要取得 chat_id
如何取得 chat_id ? 收訊者要先傳個訊息給 Bot, 然後用 getUpdates METHOD 取得
https://api.telegram.org/bot<token>/getUpdates
送訊息 https://api.telegram.org/bot<token>/sendMessage?chat_id=1234&text=test
若是群組的話, 要先將 Bot 加入群組, 再送個訊息,
一樣用 getUpdates 取得群組的 chat_id, 群組的 chat_id 好像是負數
sendMessage 時改成群組 chat_id, 就可以送訊息到群組

表情符號碼
telegram.emoji module

About this Archive

This page is an archive of recent entries written by Pank in October 2015.

Pank: September 2015 is the previous archive.

Pank: November 2015 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Monthly Archives