Skip to content

Instantly share code, notes, and snippets.

View yanzay's full-sized avatar

Alexey Grachov yanzay

View GitHub Profile
- uses: yanzay/[email protected]
if: always()
with:
chat: ${{ secrets.chat }}
token: ${{ secrets.token }}
status: ${{ job.status }}
name: 'Notify Telegram'
description: 'Get build notification to Telegram messenger'
author: 'yanzay'
inputs:
chat:
description: 'Chat to send: chat id or @channel_name'
required: true
token:
description: 'Telegram Bot token'
required: true
@yanzay
yanzay / main.go
Last active September 8, 2019 07:51
package main
import (
"fmt"
"log"
"net/http"
"os"
"strings"
"github.com/yanzay/tbot/v2"
FROM alpine:3.10
COPY LICENSE README.md /
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
name: 'Container Action Template'
description: 'Get started with Container actions'
author: 'GitHub'
inputs:
myInput:
description: 'Input to use'
default: 'world'
runs:
using: 'docker'
image: 'Dockerfile'
package main
import (
"flag"
"fmt"
"io"
"log"
"net"
"os"
)
$ # launch server
$ go run main.go -l -p 1304
$ # in separate terminal launch client
$ go run main.go localhost 1304
func startClient(addr string) {
conn, err := net.Dial("tcp", addr)
if err != nil {
fmt.Printf("Can't connect to server: %s\n", err)
return
}
_, err = io.Copy(conn, os.Stdin)
if err != nil {
fmt.Printf("Connection error: %s\n", err)
}
func main() {
flag.Parse()
if *listen {
startServer()
return
}
if len(flag.Args()) < 2 {
fmt.Println("Hostname and port required")
return
}
$ # launch our server
$ go run main.go -l -p 1304
$ # in separate terminal window connect to the server using standard netcat utility
$ nc localhost 1304