This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script ini untuk mengambil tautan berkas Buku Sekolah Elektronik dari | |
# http://bsd.pendidikan.id. | |
# | |
# Hasil script berupa berkas berisi daftar tautan menuju berkas PDF BSE yang | |
# kemudian dapat dijadikan input bagi download manager (misal wget). | |
# | |
# Sahri Riza Umami @ 2017/02/28 21:22:24 WIB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const escapeHtml = require('escape-html') | |
const Telegraf = require('telegraf') | |
const bot = new Telegraf(process.env.BOT_TOKEN) | |
function getName(user) { | |
let name = `<b>${escapeHtml(user.first_name)}</b>` | |
if (user.last_name) name += ` <b>${escapeHtml(user.last_name)}</b>` | |
if (user.username) name += ` (@${user.username})` | |
name += ` [<code>${user.id}</code>]` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Telegraf = require('telegraf') | |
const bot = new Telegraf(process.env.BOT_TOKEN) | |
function unescapeHtml(str){ | |
const map = { | |
amp: '&', | |
lt: '<', | |
le: '≤', | |
gt: '>', | |
ge: '≥', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
IFS=$'\n\t' | |
# Checking dependencies: | |
declare -a DEPS=(wget xxd) | |
for ((NUM=${#DEPS[@]},i=0; i<NUM;i++)); do | |
if command -v "${DEPS[i]}" &>/dev/null ; then | |
unset -v 'DEPS[i]' | |
fi |