Skip to content

Instantly share code, notes, and snippets.

@s4l1h
s4l1h / create.sh
Last active March 28, 2024 17:13
Kind and Istio ingress controller.
kind create cluster --config=./kind.yaml
@s4l1h
s4l1h / config.yml
Created March 6, 2023 22:36
cloudflared config file for kubernetes api server.
tunnel: xxxxx
credentials-file: /root/.cloudflared/xxxxx.json
url: https://127.0.0.1:16443
no-tls-verify: true
#micro kubernetes api server port: 16443 normally it is 6443
# we need to disable "certificate-authority-data" in .kube/config.
# when we use the kubectl port-forward we will get this error message "error: error upgrading connection: Upgrade request required"
@s4l1h
s4l1h / relay.py
Created November 7, 2021 12:07
Raspbery pi Relay
#!/usr/bin/python
import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(17, GPIO.OUT) # It does Auto set LOW and Turn Relay ON
print(GPIO.input(17))
sleep(5)
GPIO.output(17, GPIO.HIGH) # Off Relay
print(GPIO.input(17))
package menu
type Menu struct {
gorm.Model
Name string `json:"Name" validate:"required,min=3,max=15" conform:"trim"`
//Desc string
URL string `json:"URL" conform:"trim"` //validate:"required"
Blank bool `json:"Blank"`
Root bool `json:"Root"`
@s4l1h
s4l1h / frps
Created August 15, 2018 18:11
frps
#!/bin/sh
# chmod +x /etc/init.d/frps
# update-rc.d frps defaults
# update-rc.d frps enable
### BEGIN INIT INFO
# Provides: frps
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
@s4l1h
s4l1h / Dockerfile
Last active September 19, 2019 11:41
PHP 7 zts pthreads+mongodb+redis+pdo_mysql+pdo_pgsql+mysqli+curl+opcache+composer
FROM php:7-zts
RUN apt-get update
RUN apt-get install git libssl-dev libpq-dev libcurl4-openssl-dev -y
# Install mysqli+opcache+pdo
RUN docker-php-ext-install mysqli pdo pdo_mysql pdo_pgsql opcache curl
RUN docker-php-ext-enable mysqli pdo pdo_mysql pdo_pgsql opcache curl
# Install Redis
RUN pecl install redis
RUN docker-php-ext-enable redis
# Install mongodb
@s4l1h
s4l1h / v5.go
Created March 8, 2018 17:23
Golang JSON ve interface kullanımı.(v5)
package main
import (
"encoding/json"
"fmt"
)
// Person object
type Person struct {
FirstName, LastName string // Küçük harf olursa json kütüphanesi erişemeyecek.
@s4l1h
s4l1h / v4.go
Created March 8, 2018 17:06
Golang JSON ve interface kullanımı.(v4)
package main
import (
"encoding/json"
"fmt"
)
// Person object
type Person struct {
FirstName, LastName string // Küçük harf olursa json kütüphanesi erişemeyecek.
@s4l1h
s4l1h / v3.go
Created March 8, 2018 16:54
Golang JSON ve interface kullanımı.(v3)
package main
import (
"encoding/json"
"fmt"
)
// Person object
type Person struct {
FirstName, LastName string // Küçük harf olursa json kütüphanesi erişemeyecek.
@s4l1h
s4l1h / v2.go
Created March 8, 2018 16:48
Golang JSON ve interface kullanımı.(v2)
package main
import (
"encoding/json"
"fmt"
)
// Person object
type Person struct {
FirstName, LastName string // Küçük harf olursa json kütüphanesi erişemeyecek.