Skip to content

Instantly share code, notes, and snippets.

View ptflp's full-sized avatar
🤟
Quality over quantity?

Petr Filippov ptflp

🤟
Quality over quantity?
View GitHub Profile
@ptflp
ptflp / docker-install.sh
Last active September 9, 2022 13:03
docker automate installation sh
#!/bin/bash
sudo apt-get update
sudo service docker stop
sudo apt-get remove -y docker docker-engine docker.io
sudo apt-get -y install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common \
wget
@ptflp
ptflp / main.go
Created June 14, 2022 10:00
RLE Golang implementation
package main
import (
"fmt"
"strconv"
"strings"
)
func main() {
str := "aaaaaabbbbacccccaaabbbbbc"
@ptflp
ptflp / README.md
Last active May 27, 2022 05:25
git squash like automate tool

put to /usr/local/bin/git-squash

execute in bash chmod +x /usr/local/bin/git-squash

use git squash

@ptflp
ptflp / main.go
Last active May 24, 2022 15:24
34 lines Hello, world on golang
package main
import (
"fmt"
"reflect"
"regexp"
"strconv"
"unsafe"
)
@ptflp
ptflp / main.go
Last active May 10, 2022 20:44
Manual webserver golang
package main
import (
"bufio"
"fmt"
"net"
)
func main() {
l, err := net.Listen("tcp", ":8888")
@ptflp
ptflp / struct_to_bytes.go
Created May 9, 2022 15:59 — forked from SteveBate/struct_to_bytes.go
Example of converting a struct to a byte slice, compressing with gzip, and saving to file followed by the reverse process back to a struct
package main
import (
"bytes"
"compress/gzip"
"encoding/gob"
"fmt"
"io/ioutil"
"log"
"os"
@ptflp
ptflp / reboot.go
Created August 20, 2019 11:52
Windows reboot shutdown example golang go
package main
import (
"fmt"
"syscall"
"unsafe"
)
// error is nil on success
func reboot() error {
@ptflp
ptflp / main.go
Created August 19, 2021 07:00
int64 representation in bytes
package main
import (
"fmt"
"unsafe"
"reflect"
)
func main() {
var n uint64 = 1 << (1 << 6) - 1
@ptflp
ptflp / docker-compose.yml
Created August 17, 2021 08:11
nodejs docker-compose
version: '3.3'
services:
frontend:
container_name: frontend_${NODE_ENV}
image: node:14-stretch
command: npm run start
restart: always
working_dir: /app
environment:
- VIRTUAL_HOST=${ENDPOINT}
@ptflp
ptflp / WSL2GUIXvnc-en.md
Created February 8, 2021 01:13 — forked from tdcosta100/WSL2GUIXvnc-en.md
A tutorial to use GUI in WSL2 replacing original XServer by Xvnc, allowing WSL to work like native Linux, including login screen

WSL2 with GUI using Xvnc

In this tutorial, we will setup GUI in WSL2, and access it using VNC. No additional software outside WSL (like VcXsrv) is required, except, of course, a VNC Viewer (RealVNC, TightVNC, TigerVNC, UVNC, etc, all of them might work flawlessly).

The key components we need to install are tigervnc-standalone-server and systemd-genie.

For this setup, I will use Ubuntu 20.04 LTS (Focal Fossa), and install GNOME Desktop. Since the key components aren't bound to Ubuntu or GNOME, you can use your favorite distro and GUI. Check the Sample screenshots section for examples.

So let's go. First, we need a working [WSL2](https://docs.microsoft.com/pt-br/windows/wsl/w