Skip to content

Instantly share code, notes, and snippets.

View banghasan's full-sized avatar

Hasanudin H Syafaat banghasan

View GitHub Profile
@banghasan
banghasan / PertamaBot.php
Last active December 23, 2022 14:52
Sample Bot Telegram - PHP
<?php
/*
BOT PENGANTAR
Materi EBOOK: Membuat Sendiri Bot Telegram dengan PHP
Ebook live http://telegram.banghasan.com/
oleh: bang Hasan HS
@banghasan
banghasan / PertamaCurlBot.php
Last active March 3, 2019 05:46
Bot Pertama dengan PHP Curl
<?php
/**
* Bot PHP Telegram ver Curl
* Lebih Bersih
* Sample Sederhana untuk Ebook Edisi 3: Membuat Bot Sendiri Menggunakan PHP
*
* Dibuat oleh Hasanudin HS
* @hasanudinhs di Telegram dan Twitter
* Ebook live http://telegram.banghasan.com/
@banghasan
banghasan / SendTestBot.php
Last active March 20, 2023 00:30
Test Send Message Pakai PHP - Curl
<?php
/*
Simple File untuk Ngetes Send Pesan ke Bot
Memiliki banyak kegunaan dan tujuan
misalnya ngetes pesan dengan format tertentu, line break, char khusus, dll.
bisa dipergunakan juga untuk test hosting, cronjob, dan segala test lainnya.
Jika menggunakan mode GET :
@banghasan
banghasan / text-example.text
Created July 25, 2016 07:41
Markdown Test Example
An h1 header
============
Paragraphs are separated by a blank line.
2nd paragraph. *Italic*, **bold**, `monospace`. Itemized lists
look like:
* this one
* that one
/*
* setWebhook:
* curl -X POST https://api.telegram.org/botXXXXXXX/setWebhook -F url="SERVER_URL" -F certificate=@/etc/nginx/ssl/YOURPUBLIC.pem
*
* upload foto
* $postFields = array('chat_id' => $chatId, 'photo' => new CURLFile(realpath("image.png")), 'caption' => $text);
*/
@banghasan
banghasan / ssh-telegram.sh
Created October 27, 2016 05:39
Peringatan Jika Login SSH ke Telegram
# simpan file ke /etc/profile.d/
USERID="ID USER atau GROUP" #contoh 213567634
KEY="TOKENBOT" #contoh 123456789:AASDFASDW21casgW4hjtRLp4GH5wMnWlpT7Eg
TIMEOUT="10"
URL="https://api.telegram.org/bot$KEY/sendMessage"
DATE_EXEC="$(date "+%d %b %Y %H:%M")"
TMPFILE='/tmp/ipinfo-$DATE_EXEC.txt'
if [ -n "$SSH_CLIENT" ]; then
IP=$(echo $SSH_CLIENT | awk '{print $1}')
PORT=$(echo $SSH_CLIENT | awk '{print $3}')
@banghasan
banghasan / hookio.txt
Last active April 25, 2017 11:41
hookio.php
$tokenbot = $Hook['env']['tokenbot'];
$endpoint = "https://api.telegram.org/bot$tokenbot/";
$messages = $Hook["params"];
if (isset($messages['message'])) {
$messages = $messages['message'];
} else {
echo 'URL hook.io: https://'.$Hook['input']['host'].$Hook['input']['path'];
}
@banghasan
banghasan / SoftEther.sh
Created October 5, 2017 13:28
Ubuntu 16.04 SoftEther
#!/bin/bash
read -r -p "This will install SoftEther to your server. Are you sure you want to continue? [y/N] " response
case $response in
[yY][eE][sS]|[yY])
echo "Updating the system first..."
apt-get update
apt-get upgrade
apt-get install checkinstall build-essential
echo "Downloading last stable release: 4.20"
sleep 2
@banghasan
banghasan / color.php
Created January 25, 2018 03:59
php color cli
<?php
// from http://www.if-not-true-then-false.com/2010/php-class-for-coloring-php-command-line-cli-scripts-output-php-output-colorizing-using-bash-shell-colors/
class Colors {
private $foreground_colors = array();
private $background_colors = array();
public function __construct() {
// Set up shell colors
$this->foreground_colors['black'] = '0;30';
$this->foreground_colors['dark_gray'] = '1;30';
$this->foreground_colors['blue'] = '0;34';
@banghasan
banghasan / tmux.cheat
Created February 1, 2018 10:53 — forked from ellerbrock/tmux.cheat
Tmux Quick Reference & Cheat sheet - 2 column format for less scrolling!
========================================== ==========================================
TMUX COMMAND WINDOW (TAB)
========================================== ==========================================
List tmux ls List ^b w
New -s <session> Create ^b c
Attach att -t <session> Rename ^b , <name>
Rename rename-session -t <old> <new> Last ^b l (lower-L)
Kill kill-session -t <session> Close ^b &