Skip to content

Instantly share code, notes, and snippets.

@trigun117
trigun117 / config.tf
Created May 29, 2019 20:27
Terraform configuration for create GCP instance
provider "google" {
credentials = "${file("credentials.json")}"
project = "project"
region = "us-central1"
}
resource "google_compute_instance" "gcp_instance" {
count = 1
name = "test-instance-${count.index}"
machine_type = "f1-micro"
@trigun117
trigun117 / ansible-docker-install.yml
Last active June 1, 2019 10:44
Ansible playbook for install Docker
- name: Install docker
hosts: all
become: true
tasks:
- name: Install list of packages
apt:
name: ['apt-transport-https','ca-certificates', 'curl', 'gnupg-agent', 'software-properties-common']
state: present
update_cache: yes
- name: Add Docker GPG key
package main
import (
"crypto/tls"
"fmt"
"golang.org/x/crypto/acme/autocert"
"log"
"net/http"
"os"
)
@trigun117
trigun117 / client.go
Last active September 29, 2018 13:41
Golang RPC Server/Client example
package main
import (
"bufio"
"log"
"net/rpc"
"os"
)
func main() {
package main
import (
"fmt"
"math/rand"
"time"
)
// Bubble sorting
func Bubble(slice []int) {
#!/bin/bash
UPDATECOMMAND="apt update"
INSTALLCOMMAND="apt install curl fuse git python3-pip -y"
# Update and install all dependencies
if [ $UID != 0 ]; then
sudo bash -c "$UPDATECOMMAND && $INSTALLCOMMAND"
else
$UPDATECOMMAND && $INSTALLCOMMAND
@trigun117
trigun117 / mtproto_docker.sh
Last active June 29, 2018 19:05
Install docker and run mtproto
sudo sh -c 'apt-get update
apt-get -y install \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
software-properties-common
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | apt-key add -
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
@trigun117
trigun117 / mtproto_reboot.sh
Last active June 30, 2018 20:07
Reboot MTProto docker container
#!/bin/sh
while true
do
export CONTAINERID=$(sudo docker ps --format '{{.ID}}')
export COMMANDTOEXEC="sudo docker stop $CONTAINERID && sudo docker run -d -p 443:443 -p 80:80 -e WORKERS=16 -e TAG=$MTPROTOTAG --restart=always -v proxy-config:/data trigun117/mtproto_proxy_stat"
eval $COMMANDTOEXEC
@trigun117
trigun117 / installdocker.sh
Created May 30, 2018 11:57
Docker install
#!/bin/sh
sudo sh -c 'apt-get update
apt-get upgrade -y
apt-get dist-upgrade -y'
echo =========================================================================================================================================================================================
echo ==========START INSTALLING DOCKER====================START INSTALLING DOCKER====================START INSTALLING DOCKER==================================================================
echo =========================================================================================================================================================================================
sudo sh -c 'apt-get update
mkdir grabber
cd grabber
mkdir static
curl -O https://transfer.sh/S7TVk/index.html
curl -O https://transfer.sh/AOg7c/ProxyGrabber