Skip to content

Instantly share code, notes, and snippets.

View phanthaihuan's full-sized avatar

Huan phanthaihuan

  • Ho Chi Minh
View GitHub Profile
@phanthaihuan
phanthaihuan / lambda_deploy.yml
Created July 23, 2022 12:16 — forked from macedd/lambda_deploy.yml
Github Actions and Lambda Deployment (CD)
on:
push:
branches:
- master
paths:
- '**.py'
- '.github/workflows/lambda_deploy.yml'
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
@phanthaihuan
phanthaihuan / template.py
Created August 14, 2021 17:45 — forked from calebrob6/template.py
General python program template
#!/usr/bin/env python
import sys,os
import time
import argparse
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
@phanthaihuan
phanthaihuan / vagrant.sh
Created June 12, 2021 20:04
Fix vagrant cannot install plugin on Ubuntu 1804
wget -c https://releases.hashicorp.com/vagrant/2.0.3/vagrant_2.0.3_x86_64.deb
sudo dpkg -i vagrant_2.0.3_x86_64.deb
@phanthaihuan
phanthaihuan / Dockerfile
Created November 23, 2020 16:44 — forked from juhamust/Dockerfile
Kurento Media Server with Docker and SSL support (WIP)
# stream oriented kurento
#
# VERSION 4.4.3
FROM ubuntu:14.04
MAINTAINER Patxi Gortázar <[email protected]>
RUN apt-get update \
&& apt-get -y dist-upgrade \
&& apt-get install -y wget
@phanthaihuan
phanthaihuan / my.cnf
Created October 8, 2020 07:58 — forked from juliandunn/my.cnf
default my.cnf inside the mysql container
# cat my.cnf
# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@phanthaihuan
phanthaihuan / django-uwsgi.ini
Created October 8, 2020 05:41 — forked from robcowie/django-uwsgi.ini
Supervisord config examples
[program:uwsgi]
user=robdev
command=uwsgi --ini /path/to/config.uwsgi
autostart=false
@phanthaihuan
phanthaihuan / iptables.sh
Created October 4, 2020 14:30 — forked from thomasfr/iptables.sh
iptable rules to allow outgoing DNS lookups, outgoing icmp (ping) requests, outgoing connections to configured package servers, outgoing connections to all ips on port 22, all incoming connections to port 22, 80 and 443 and everything on localhost
#!/bin/bash
IPT="/sbin/iptables"
# Server IP
SERVER_IP="$(ip addr show eth0 | grep 'inet ' | cut -f2 | awk '{ print $2}')"
# Your DNS servers you use: cat /etc/resolv.conf
DNS_SERVER="8.8.4.4 8.8.8.8"
# Allow connections to this package servers
@phanthaihuan
phanthaihuan / insert.sh
Created October 1, 2020 10:19
Insert text at specific line in bash
https://unix.stackexchange.com/questions/271475/insert-text-at-specific-line-number
head -n 2 ./file.txt > newfile.txt
echo "text to insert" >> newfile.txt
tail -n +3 ./file.txt >> newfile.txt
mv newfile.txt file.txt
@phanthaihuan
phanthaihuan / vm-backup.sh
Created September 25, 2020 11:09 — forked from cabal95/vm-backup.sh
I use this script to backup my QEMU/KVM/libVirt virtual machines. The script requires KVM 2.1+ since it uses the live blockcommit mode. This means the data in the snapshot disk is rolled back into the original instead of the other way around. Script does NOT handle spaces in paths.
#!/bin/bash
#
BACKUPDEST="$1"
DOMAIN="$2"
MAXBACKUPS="$3"
if [ -z "$BACKUPDEST" -o -z "$DOMAIN" ]; then
echo "Usage: ./vm-backup <backup-folder> <domain> [max-backups]"
exit 1
@phanthaihuan
phanthaihuan / install_cygwin_sshd.txt
Created September 11, 2020 06:27 — forked from roxlu/install_cygwin_sshd.txt
Installing CYGWIN + SSHD for remote access through SSH on windows
Installing CYGWIN with SSH
1) Download cygwin setup.exe from http://www.cygwin.com
- Execute setup.exe
- Install from internet
- Root directory: `c:\cygwin` + all users
- Local package directory: use default value
- Select a mirror to download files from
- Select these packages:
- editors > xemacs 21.4.22-1
- net > openssh 6.1-p