Skip to content

Instantly share code, notes, and snippets.

View iamralch's full-sized avatar

Svetlin Ralchev iamralch

View GitHub Profile
@iamralch
iamralch / ssh_client.go
Last active April 16, 2023 03:09
SSH client in GO
package main
import (
"fmt"
"io"
"io/ioutil"
"net"
"os"
"strings"
@iamralch
iamralch / sshtunnel.go
Last active April 16, 2023 03:07
SSH tunnelling in Golang
package main
import (
"log"
"bufio"
"time"
"os"
"fmt"
"io"
"net"
@iamralch
iamralch / compress.go
Last active April 16, 2023 03:04
ZIP archives in Golang
import (
"archive/zip"
"io"
"os"
"path/filepath"
"strings"
)
func zipit(source, target string) error {
zipfile, err := os.Create(target)
@iamralch
iamralch / subcommand.go
Created July 4, 2015 15:50
flag package: subcommand example
package main
import (
"flag"
"fmt"
"os"
)
func main() {
askCommand := flag.NewFlagSet("ask", flag.ExitOnError)
@iamralch
iamralch / gzip.go
Created July 24, 2015 20:39
Gzip archives in Go
import (
"compress/gzip"
"fmt"
"io"
"os"
"path/filepath"
"strings"
)
func gzipit(source, target string) error {
openapi: 3.0.1
info:
title: StorageAPI
description:
Swagger definition of the tus core protocol and official extensions.
The paths are not normative, but showcase the example definition at https://github.com/tus/tus-resumable-upload-protocol/blob/master/protocol.md
contact:
email: garcia@lrz.de
license:
openapi: 3.0.0
info:
title: Render API
version: "1.0"
contact:
name: Cliche Digital Engineering
url: https://github.com/cliche-digital/render-api
email: engineering@cliche.digital
@iamralch
iamralch / Singleton.cs
Last active March 28, 2021 07:21
The Singleton Design Pattern in C#
public abstract class Singleton<T> where T : class
{
private static volatile T _instance;
private static readonly object _locker = new object();
public static T Instance
{
get
{
if (_instance == null)
@iamralch
iamralch / context.go
Created November 20, 2015 13:05
An example that illustrates how to work with https://godoc.org/golang.org/x/net/context
package main
import (
"bufio"
"fmt"
"os"
"strings"
"time"
"golang.org/x/net/context"
@iamralch
iamralch / reset_virtualbox_dhcp_leases.sh
Created November 3, 2020 11:15 — forked from stafot/reset_virtualbox_dhcp_leases.sh
Resets virtualbox DHCP leases to ensure that minikube will always take a specific IP.
#!/usr/bin/env bash
function minikube_reset_vbox_dhcp_leases() {
# Check OS version
case $OSTYPE in
darwin*)
VBOX_CONFIG_DIR=Library
;;
linux*)