Skip to content

Instantly share code, notes, and snippets.

View jreisinger's full-sized avatar
👋
hello friend

Jozef Reisinger jreisinger

👋
hello friend
View GitHub Profile
// run this as root on Linux - https://github.com/lizrice/containers-from-scratch/issues/1
package main
import (
"fmt"
"os"
"os/exec"
"syscall"
)
#!/usr/bin/env python3
from pprint import pprint as pp
def dedup2(items, key=None):
""" Get unique items but keep the order.
Works even with non-hashable items.
"""
seen = set()
for item in items:
#!/usr/bin/env python3
""" Reads a file and returns the number of lines, words
and characters similar to the UNIX wc utility.
"""
infile = open("word_count.txt")
lines = infile.read().splitlines()
line_count = 0
// Goroutines can share a single channel and multiple goroutines can read or write from the channel. It can be exploited to make workload balancer in just a few lines of code.
package main
import (
"fmt"
"io/ioutil"
"net/http"
_ "os"
)
package main
import (
"fmt"
"time"
)
func emit(channelCh chan chan string, doneCh chan bool) {
wordCh := make(chan string)
defer close(wordCh) // close on return
// Must be run as root
package main
import (
"fmt"
"os"
"os/exec"
"syscall"
)
package main
import (
"fmt"
"io"
"os"
)
var output = make(map[io.Writer]bool)
package main
import (
"fmt"
"time"
)
// Anything that has Error() function is an Error, i.e. satisfied the Error
// interface.
package main
import (
"fmt"
"regexp"
)
var re = regexp.MustCompile("[0-9]*")
func main() {
package main
import (
"fmt"
"io/ioutil"
"net/http"
"os"
)
// user-defined type based on struct built-in type