Skip to content

Instantly share code, notes, and snippets.

View iamralch's full-sized avatar

Svetlin Ralchev iamralch

View GitHub Profile
@iamralch
iamralch / debug_app.go
Created August 4, 2015 20:49
Sample application used to demonstrates LLDB and DELVE debuggers
// main.go
package main
import "fmt"
type User struct {
FirstName string
LastName string
}
@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 / 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 {
@iamralch
iamralch / tarball.go
Created July 24, 2015 20:35
Tar packages in Go
import (
"archive/tar"
"fmt"
"io"
"os"
"path/filepath"
"strings"
)
func tarit(source, target string) error {
@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)
package main
import (
"os"
"syscall"
"time"
)
func pipe(path string) (*os.File, *os.File, error) {
syscall.ForkLock.RLock()
@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 / searchr.go
Created July 11, 2015 11:50
searchr - a sample application that works with pipes
package main
import (
"bufio"
"flag"
"fmt"
"io"
"os"
"strings"
)
@iamralch
iamralch / custom_flag.go
Created July 6, 2015 20:40
Custom flag arguments with flag package in Go
package main
import (
"flag"
"fmt"
"net/url"
"strings"
)
type UrlFlag struct {
@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)