Skip to content

Instantly share code, notes, and snippets.

View hoai's full-sized avatar

hoai hoai

View GitHub Profile
@hoai
hoai / Xvfb.service
Created October 19, 2021 09:01 — forked from ypandit/Xvfb.service
Xvfb as a systemd service
[Unit]
Description=X Virtual Frame Buffer Service
After=network.target
[Service]
ExecStart=/usr/bin/Xvfb :99 -screen 0 1024x768x24
[Install]
WantedBy=multi-user.target
@hoai
hoai / FFmpeg | Basic Operation on Subtitles.md
Created October 13, 2021 04:22 — forked from innat/FFmpeg | Basic Operation on Subtitles.md
Remove hard subtitles from video file || Integrate subtitles into a video file || Generate .srt file from a video file.

Download FFmpeg for Windows

Steps

  • Download FFmpeg
  • Extract it and save it to C drive ( choose any location - it's optional )
  • Set environment variable - copy the location of bin folder which is inside the extracted file and set the location on system path variable.
  • Done!
@hoai
hoai / ffmpeg-tips.md
Created October 9, 2021 07:37 — forked from revolunet/ffmpeg-tips.md
ffmpeg tips

convert to another format, resize withouth quality loss

ffmpeg -i vitrine.mp4 -vf scale=1024:-1 -q:vscale 0 vitrine.avi

concat video files

ffmpeg -f concat -i repeat.txt -c copy vitrine2.mp4

in repeat.txt:

file 'file1.avi'
file 'file2.avi'
@hoai
hoai / disposable-email-provider-domains
Created October 5, 2021 06:59
List of disposable email provider domains
0815.ru
0wnd.net
0wnd.org
10minutemail.co.za
10minutemail.com
123-m.com
1fsdfdsfsdf.tk
1pad.de
20minutemail.com
21cn.com
FROM golang:alpine as builder
RUN mkdir /build
ADD . /build/
WORKDIR /build
RUN go build -o microserv .
FROM alpine
RUN mkdir /app
ADD . /app/
COPY --from=builder /build/microserv /app
WORKDIR /app
type T struct {
A int
B string
}
t := T{23, "skidoo"}
s := reflect.ValueOf(&t).Elem()
typeOfT := s.Type()
for i := 0; i < s.NumField(); i++ {
@hoai
hoai / json_to_map.go
Created June 28, 2021 06:26 — forked from cuixin/json_to_map.go
json to map[string]interface{} example in golang
package main
import (
"encoding/json"
"fmt"
)
func dumpMap(space string, m map[string]interface{}) {
for k, v := range m {
if mv, ok := v.(map[string]interface{}); ok {
@hoai
hoai / dump.go
Created June 23, 2021 15:11 — forked from ahmdrz/dump.go
Golang Reflection Example of an array.
package main
import (
"fmt"
"reflect"
)
type Test struct {
Name string
}
@hoai
hoai / gist:bc459cf044ed292260ea37f10698a50d
Created June 10, 2021 07:50
I can't install gcc with scoop, so install dorado / nuwen-mingw-gcc
I'm using scoop for Windows package management, but recently I can't install gcc with the following installation command.
$ scoop install gcc
Installing 'gcc' (9.3.0-2) [64bit]
mingw-w64-x86_64-binutils-2.34-1-any.pkg.tar.xz (13.9 MB) [===================================================] 100%
Checking hash of mingw-w64-x86_64-binutils-2.34-1-any.pkg.tar.xz ... ok.
mingw-w64-x86_64-crt-git-8.0.0.5815.9517d302-1-any.pkg.tar.xz (3.1 MB) [======================================] 100%
Checking hash of mingw-w64-x86_64-crt-git-8.0.0.5815.9517d302-1-any.pkg.tar.xz ... ok.
The remote server returned an error: (404) Not Found.
URL http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-expat-2.2.9-1-any.pkg.tar.xz is not valid
@hoai
hoai / Laravel-Container.md
Created June 9, 2021 04:17
Laravel's Dependency Injection Container in Depth

Laravel's Dependency Injection Container in Depth

Translations: Korean (by Yongwoo Lee)

Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.

Introduction to Dependency Injection

I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).