Skip to content

Instantly share code, notes, and snippets.

@alochym01
alochym01 / gist:4c8d3e9793a8faef2fae1c7e61c36ca5
Last active December 8, 2016 01:31
code for Mr Thaitnt :)
import urllib2
import urllib
import re
import json
from base64 import b64decode, b64encode
from Crypto.Cipher import AES
from Crypto.Hash import MD5
# We need 32 bytes for the AES key, and 16 bytes for the IV
def openssl_kdf(req, secret, salt):
@alochym01
alochym01 / verto sample script
Created June 1, 2018 02:30
verto phone sample script for freeswitch
// http://lists.freeswitch.org/pipermail/freeswitch-users/2016-July/121412.html
// var myverto = new $.verto({yada: yada});
// myverto.hangup(); // hangup all active calls
// myverto.purge(); // probably not necessary but doesn't hurt. Cleans out
// table internally.
// myverto.logout(); // Disconnect WebSocket
(function() {
var vertoHandle, vertoCallbacks, destinationNumber, currentCall, ext, passExt;
@alochym01
alochym01 / nginx_version.md
Created October 21, 2019 09:19
yum install with specified version
  • First, you should take a look at what packages are available

    yum --showduplicates list nginx

  • Looking at that repo, it appears that nginx 1.6.3-1 is the version you want.

  • You can install the specific version by appending it to the package name with a dash:

yum install nginx-1.6.3-1

  1. Create Upstream Object - curl -X POST http://master-1:8001/upstreams --data name=users-upstream
  2. Assign target to Upstream Services
    curl -X POST http://master-1:8001/upstreams/users-upstream/targets --data target='192.168.2.20:5001'
    curl -X POST http://master-1:8001/upstreams/users-upstream/targets --data target='192.168.2.20:5002'
  3. Create Services Object with upstream
    curl -i -X POST http://master-1:8001/services/ --data 'name=users-services' --data host='users-upstream'
@alochym01
alochym01 / paginator.go
Created August 26, 2021 15:23
Create a simple Pagination - golang programming
package main
import (
"database/sql"
"encoding/json"
"flag"
"fmt"
"log"
"net/http"
"os"
@alochym01
alochym01 / How-to-work-with-JSON.md
Last active October 23, 2021 09:54
How to work with Golang JSON

Work with JSON in GO

Marshal a struct into JSON Object in GO

  • Convert a struct into JSON Object for debug

JSON Encode in GO

  • How to
    1. Declare a Movie struct
      // Movie struct
      type Movie struct {
      	Title string

Harbor Private Registry

Software

  • Ubuntu 20.04.4 TLS
    • Router - 42.118.242.163
    • K8s-master - 10.0.0.200
    • Elastic-01 - 10.0.0.51
    • Elastic-02 - 10.0.0.52
    • Elastic-03 - 10.0.0.53

Tekton with Kind

Software

  1. kind version 0.14.0
  2. kubernetes version 1.23.6
    1. kubectl version 1.23.6
  3. tekton version
    1. Client version 0.25.0
    2. Pipeline version 0.38.0

Installation