Skip to content

Instantly share code, notes, and snippets.

#!/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
package main
import (
"fmt"
"math/rand"
"time"
)
// Bubble sorting
func Bubble(slice []int) {
@squaredice
squaredice / 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 (
"crypto/tls"
"fmt"
"golang.org/x/crypto/acme/autocert"
"log"
"net/http"
"os"
)
@squaredice
squaredice / 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
@squaredice
squaredice / 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"