Skip to content

Instantly share code, notes, and snippets.

View nutzhub's full-sized avatar
🎯
Focusing

Pradit Rattanapongchinda nutzhub

🎯
Focusing
  • Omise
  • Bangkok Thailand
View GitHub Profile
@nutzhub
nutzhub / ipsec-monitor.sh
Created December 22, 2016 04:04 — forked from winhamwr/ipsec-monitor.sh
Script to check the status of ipsec tunnels and refresh them if they're down. This should be run from cron every minute. To add monitoring on a tunnel, add a commented-out `monitor` line with the IP and port to use for establishing connection status. eg. `#monitor 172.17.105.80 9898` Adapted from a script posted by user "c b" on Strongswan [issu…
#!/bin/bash
function main()
{
monitor_from_file $*
}
function monitor_vpn_ip_port()
{
local CONN_NAME=$1
@nutzhub
nutzhub / iptables
Last active October 15, 2016 14:15
# Generated by iptables-save v1.4.14 on Thu Oct 13 14:33:13 2016
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m tcp -s 188.166.176.236 --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp -d 49.231.140.50 -j ACCEPT
-A INPUT ! -s 1.46.0.0/15 -i eno1 -p tcp -m tcp -j DROP
COMMIT
{
"count": "5",
"items": [
{
"title": "Blaron blå is eating",
"url": "http://www.sedenne.no/v/43462/sa-nar-har-du-aldri-sett-dem",
"text": "",
"image": "http://ws.vipr.startsiden.no/images/29/10/29103.jpg",
"created": "2014-08-08T09:53:45+02:00"
},
cat /etc/ssh/sshd_config
sshd_config sshd_config~
root@greatatuin:~# cat /etc/ssh/sshd_config
# Package generated configuration file
# See the sshd_config(5) manpage for details
# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
@nutzhub
nutzhub / nginx.conf
Last active August 29, 2015 14:26 — forked from calebwoods/nginx.conf
Sample Nginx config for deployment of Angular.js app
server { listen 80;
server_name example.com;
access_log /var/log/example.com/nginx.access.log;
error_log /var/log/example.com/nginx.error.log;
root /var/www/apps/example.com/public;
charset utf-8;
location / {
rewrite ^ https://$host$request_uri? permanent;
}

What is your folder-structure preference for a large-scale Node.js project?

0: Starting from Rails

This is the reference point. All the other options are based off this.

|-- app
|   |-- controllers
|   |   |-- admin
server {
listen 80;
server_name chat.dev.abctech-thailand.com ~.+\.chat\.dev\.abctech-thailand\.com$ ~.+\.chat\.int\.abctech-thailand\.com$ chat.abct.io;
location / {
proxy_pass http://meetv:8080/;
proxy_http_version 1.1;
proxy_redirect off;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Port 443;
proxy_set_header Host $host;
use strict;
use warnings;
use Test::More;
use Test::WWW::Mechanize::Catalyst;
use FindBin;
use Mojo::DOM;
use lib "$FindBin::Bin/lib";
use TestSetup;
our $db;
@nutzhub
nutzhub / package.json
Created June 16, 2014 03:19
Builder config in package.json
{
"name": "meetv-chat-server",
"version": "1.0.1",
"description": "Server backend for the MeeTV Chat app",
"scripts": {
"start": "node --debug script/server.js",
"test" : "prove --exec './node_modules/buster/bin/buster-test --reporter tap -t' test -v"
},
"dependencies": {
"express" : "3.x",
@nutzhub
nutzhub / .jshintrc
Created December 25, 2013 06:29 — forked from haschek/.jshintrc
{
// --------------------------------------------------------------------
// JSHint Configuration, Strict Edition
// --------------------------------------------------------------------
//
// This is a options template for [JSHint][1], using [JSHint example][2]
// and [Ory Band's example][3] as basis and setting config values to
// be most strict:
//
// * set all enforcing options to true