Skip to content

Instantly share code, notes, and snippets.

Avatar
🤟
Quality over quantity?

Petr Filippov ptflp

🤟
Quality over quantity?
View GitHub Profile
@ptflp
ptflp / main.go
Created Aug 19, 2021
int64 representation in bytes
View main.go
package main
import (
"fmt"
"unsafe"
"reflect"
)
func main() {
var n uint64 = 1 << (1 << 6) - 1
@ptflp
ptflp / docker-compose.yml
Created Aug 17, 2021
nodejs docker-compose
View docker-compose.yml
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 Feb 8, 2021 — 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
View WSL2GUIXvnc-en.md

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

@ptflp
ptflp / main.go
Last active Dec 4, 2020
Linux tree command, realized on golang (Draft)
View main.go
package main
import (
"fmt"
"log"
"os"
"path/filepath"
"strings"
)
@ptflp
ptflp / main.go
Created Oct 19, 2020
Manual webserver golang
View main.go
package main
import (
"bufio"
"fmt"
"net"
)
func main() {
l, err := net.Listen("tcp", ":8888")
@ptflp
ptflp / main.go
Created Apr 5, 2020
Upload file through telegram bot to chat id
View main.go
package main
import (
"bytes"
"fmt"
"io"
"io/ioutil"
"mime/multipart"
"net/http"
"os"
@ptflp
ptflp / Dockerfile
Created Mar 23, 2020
Safe non root user container execution
View Dockerfile
FROM php:7.2-fpm
# Copy composer.lock and composer.json
# COPY composer.lock composer.json /var/www/
# Set working directory
WORKDIR /var/www
# Install dependencies
RUN apt-get update && apt-get install -y \
@ptflp
ptflp / README.md
Last active Mar 23, 2020
Fast create OpenVPN server
View README.md

Firstly

export OVPN_DATA="ovpn-data"

then

chmod +x ./startserver.sh
./startserver.sh
@ptflp
ptflp / main.go
Created Jan 31, 2020
Golang Fibonacci on channels
View main.go
package main
import "fmt"
func fibonacci(out chan uint, quit chan struct{}) {
var x, y uint
x, y = 0, 1
for {
select {
case out <- x:
@ptflp
ptflp / finger.sh
Created Jan 27, 2020
Add fingerprint of github.com automatically by bash script
View finger.sh
#!/bin/bash
echo "Applying fingerprint"
ssh-keygen -F github.com || ssh-keyscan github.com >>~/.ssh/known_hosts