Skip to content

Instantly share code, notes, and snippets.

View Guaderxx's full-sized avatar

顾阿德 Guaderxx

View GitHub Profile
to check if the server works - https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice
stun:
stun.l.google.com:19302,
stun1.l.google.com:19302,
stun2.l.google.com:19302,
stun3.l.google.com:19302,
stun4.l.google.com:19302,
stun.ekiga.net,
stun.ideasip.com,
@Guaderxx
Guaderxx / ns_show.c
Created January 3, 2024 06:52
ioctl_ns(2) Example
/* ns_show.c
Licensed under the GNU General Public Lecense v2 or later.
*/
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
@Guaderxx
Guaderxx / clone_uts_ns.c
Created January 3, 2024 04:51
clone(2) Example
#define _GNU_SOURCE
#include <sys/wait.h>
#include <sys/utsname.h>
#include <sched.h>
#include <string.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/mman.h>
@Guaderxx
Guaderxx / mediator_pattern.go
Created December 15, 2023 13:07
mediator pattern
package main
import "fmt"
type airplane interface {
arrive()
depart()
permitArrival()
}
@Guaderxx
Guaderxx / functional_options.go
Created December 15, 2023 11:27
functional options pattern
package main
import "fmt"
type Student struct {
Name string
Age int
Address *string // optional
PhoneNumber *int // optional
}
@Guaderxx
Guaderxx / singleton.go
Created December 15, 2023 11:16
singleton
package main
import "fmt"
type SingletonCon struct {
url string
port string
}
var singletonConInstance *SingletonCon
@Guaderxx
Guaderxx / main.go
Created December 15, 2023 10:44
Proxy pattern
package main
import "fmt"
type Driven interface {
Drive()
}
type Car struct{}
@Guaderxx
Guaderxx / main.go
Last active December 15, 2023 09:01
chain of responsibility
package main
import "fmt"
type Request struct {
amount int
}
type Handler interface {
SetNext(handler Handler) Handler
@Guaderxx
Guaderxx / decorator.go
Created December 15, 2023 05:55
decorator pattern
package main
import "fmt"
type Printer interface {
Print() string
}
type SimplePrinter struct {}
@Guaderxx
Guaderxx / search_issues.go
Last active December 8, 2023 10:50
github api cli
package main
import (
"encoding/json"
"fmt"
"log"
"net/url"
"os"
"strings"
"time"