Skip to content

Instantly share code, notes, and snippets.

View linhxhust's full-sized avatar

Linh Nguyen linhxhust

View GitHub Profile
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
@linhxhust
linhxhust / gist:8496eeefc1894f566393bd170d96bea4
Created December 1, 2023 13:11
Terraform deploy Cloudflare Tunnel on K8s
resource "random_password" "tunnel_secret" {
count = local.is_mgnt_env ? 1 : 0
length = 64
}
# Creates a new locally-managed tunnel for the GCP VM.
resource "cloudflare_tunnel" "auto_tunnel" {
count = local.is_mgnt_env ? 1 : 0
account_id = var.CF_ACCOUNT_ID
name = "Terraform MGNT Tunnel"
@linhxhust
linhxhust / csgo-server-guide.md
Created October 15, 2021 08:17 — forked from zabustak/csgo-server-guide.md
Complete Guide for Hosting CS:GO Dedicated Servers

Complete Guide for Hosting a CS:GO Dedicated Server

Creative Commons License.

I tested the setup on Debian Stretch (naive installation) and Jessie (LinuxGSM installation). The setup should work on Debian 8 (Jessie), Debian 9 (Stretch) and Ubuntu (16.04). However, If you're running on Windows or other non-debian based Linux OS (e.g. CentOS, openSUSE), this guide doesn't apply to you.

My Servers:

I'm hosting FFA warm-up and HvH(soon) servers in San Francisco, welcome to join by:

IPv4: 159.89.154.137   
Ipv6: 2604:a880:2:d0::20ad:2001 
[client]
port = 3306
socket = /data/mysql/data/mysqld.sock
[mysqld_safe]
socket = /data/mysql/data/mysqld.sock
nice = 0
[mysqld]
# TODO: change here
@linhxhust
linhxhust / convert_ip.py
Created August 18, 2017 10:53
Convert IP string to integer. Extract host_min, host_max from CIDR
import mysql.connector
import sys, struct, socket
def extract(cidr):
(ip, cidr) = cidr.split('/')
cidr = int(cidr)
host_bits = 32 - cidr
i = struct.unpack('>I', socket.inet_aton(ip))[0]
host_min = (i >> host_bits) << host_bits
host_max = i | ((1 << host_bits) - 1)

[provide general introduction to the issue logging and why it is relevant to this repository]

Context

[provide more detailed introduction to the issue itself and why it is relevant]

Process

[ordered list the process to finding and recreating the issue, example below]

call plug#begin('~/.vim/plugged')
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'jiangmiao/auto-pairs'
Plug 'alvan/vim-closetag'
Plug 'ervandew/supertab'
Plug 'scrooloose/nerdcommenter'
Plug 'tpope/vim-surround'
Plug 'terryma/vim-multiple-cursors'
@linhxhust
linhxhust / .vimrc
Created July 23, 2017 15:22
My .vimrc configuration
set ff=unix
" Cancel backup
set nobackup
set nowritebackup
set noswapfile
set noundofile
" Autoload vimrc after edit
" autocmd! bufwritepost .vimrc source %
(function () {
document.getElementById("iframe_zing").src = "http://mp3.zing.vn/embed/song/ZWZ9Z0B8";
})();
#!/bin/bash
cdr_path="/path/to/cdr/rec/"
for cdr_file in `ls ${cdr_path}`
do
printf "Process file: ${cdr_file}\n"
file_path="${cdr_path}${cdr_file}"
ex +"%s/$/${cdr_file}/g" -cwq $file_path
done