Skip to content

Instantly share code, notes, and snippets.

🦈
Shark

Salvatore Cordiano salvatorecordiano

Block or report user

Report or block salvatorecordiano

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:ef5cdf789d7d983c9e717a90777d7743
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
View gist:ac6ca35ac032f50d861675b092e017a4
# first way
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
View webhook.php
<?php
header('Content-Type: application/json');
$content = file_get_contents('php://input');
$update = json_decode($content, true);
if (!$update) {
exit;
}
$chatId = $update['message']['chat']['id'] ?? null;
@salvatorecordiano
salvatorecordiano / prepare-commit-msg
Last active Nov 21, 2017
Prepending Git commit messages with Jira IDs
View prepare-commit-msg
#!/bin/bash
# curl -s https://gist.githubusercontent.com/salvatorecordiano/ff73d811c8933c08ea68c1177f3db6c9/raw/6312ceaa840928164afa06e0e42968753b745f61/prepare-commit-msg > .git/hooks/prepare-commit-msg && chmod +x .git/hooks/prepare-commit-msg
COMMIT_MESSAGE=$(cat $1)
PRECOMMIT_MESSAGE=$(git symbolic-ref --short HEAD | grep -Eo "[A-Z0-9]+-[A-Z0-9]+")
RED=`tput setaf 1`
GREEN=`tput setaf 2`
RESET=`tput sgr0`
if [ ! -z "$PRECOMMIT_MESSAGE" ]; then
@salvatorecordiano
salvatorecordiano / response.json
Created Sep 11, 2017
Sample Telegram response
View response.json
{
"update_id": 111111111,
"message": {
"message_id": 1,
"from": {
"id": 01234567890,
"is_bot": false,
"first_name": "Steve",
"last_name": "Jobs",
"username": "stevejobs",
View requestPhoneNumber.php
<?php
$chatId = '---YOUR USER ID---';
$request = [
'chat_id' => $chatId,
'text' => 'Fai tap su condividi numero telefonico',
'reply_markup' => [
'keyboard' => [
[
View webhook.php
<?php
$content = file_get_contents("php://input");
$update = json_decode($content, true);
if (! $update) {
exit;
}
$chatId = $update['message']['chat']['id'] ?? null;
View execute.php
<?php
$content = file_get_contents("php://input");
$update = json_decode($content, true);
if(! $update) {
exit;
}
$chatId = $update['message']['chat']['id'] ?? null;
$text = $update['message']['text'] ?? null;
View execute.php
<?php
// recupero il contenuto inviato da Telegram
$content = file_get_contents("php://input");
// converto il contenuto da JSON ad array PHP
$update = json_decode($content, true);
// se la richiesta è null interrompo lo script
if(!$update)
{
exit;
}
View execute.php
<?php
// recupero il contenuto inviato da Telegram
$content = file_get_contents("php://input");
// converto il contenuto da JSON ad array PHP
$update = json_decode($content, true);
// se la richiesta è null interrompo lo script
if(!$update)
{
exit;
}
You can’t perform that action at this time.