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 | |
# This works only on raspbian | |
printf "%-15s%5s\n" "TIMESTAMP" "TEMP (deg C)" | |
printf "$20s\n" "-------------------------------" | |
while true | |
do | |
temp=$(vcgencmd measure_temp | egrep -o '[0-9]*\.[0-9]*') |
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
source ~/.zshrc | |
pyenv --version | |
if [ $? -eq 0 ]; then | |
printf "\n${bold}Pyenv installed... moving ahead...\n" | |
ibrew install zlib | |
ibrew install readline | |
arch -x86_64 pyenv install $(pyenv install --list | grep -v - | grep -v b | tail -1) | |
arch -x86_64 pyenv global $(pyenv install --list | grep -v - | grep -v b | tail -1) | |
else | |
printf "\n${bold}Pyenv is not installed... Please try again...\n" |
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
# Installing node | |
printf "\n${bold}Node.JS (Only v15 supported as of now)\n" | |
printf "Refer here for more details: https://github.com/nvm-sh/nvm/issues/2350\n" | |
. ~/.nvm/nvm.sh | |
nvm > /dev/null | |
if [ $? -eq 0 ]; then | |
printf "NVM Already installed... Proceeding further...\n" | |
node -v | |
if ! [ $? -eq 0 ]; then | |
nvm install node |
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
# Array to install all the formulae some of them may require other taps so not including them here | |
commands_install=( | |
zsh-syntax-highlighting | |
go | |
android-platform-tools | |
htop | |
openjdk | |
redis | |
pyenv | |
) |
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
# This just considers all existing aliases and path to the current script | |
source ~/.zshrc | |
# To make the text bold in shell | |
bold=$(tput bold) | |
# Function to check if a certain command/tool has been installed | |
check_install_result() { | |
if [ $? -eq 0 ]; then | |
printf "\n${bold}$1 installed successfully\n" |
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
// SendTextToTelegram sends text to the user | |
func SendTextToTelegram(chatID int, text string, keyboard []byte) (string, error) { | |
log.Printf("Sending to chat_id: %d", chatID) | |
// log.Printf(string(keyboard)) | |
log.Printf(text) | |
response, err := http.PostForm( | |
types.TelegramAPI, | |
url.Values{ | |
"chat_id": {strconv.Itoa(chatID)}, |
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
// ParseTelegramUpdate takes in the request from telegram and parses Update from it | |
func ParseTelegramUpdate(r *http.Request) (*types.Update, error) { | |
var update types.Update | |
if err := json.NewDecoder(r.Body).Decode(&update); err != nil { | |
return nil, err | |
} | |
return &update, nil | |
} |
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
// Update is the type of request that telegram sends once u send message to the bot | |
type Update struct { | |
UpdateID int `json:"update_id"` | |
Message Message `json:"message"` | |
CallbackQuery CallbackQuery `json:"callback_query"` | |
} | |
// Message is the structure of the message sent to the bot | |
type Message struct { | |
Text string `json:"text"` |
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
package main | |
import ( | |
"fmt" | |
"os" | |
"os/signal" | |
"syscall" | |
"time" | |
) |
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
Verifying my Blockstack ID is secured with the address 13oMTebk6yMJKKiJLsvqjTUXKTXyycHpQh https://explorer.blockstack.org/address/13oMTebk6yMJKKiJLsvqjTUXKTXyycHpQh |
NewerOlder