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
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 ::
{
"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"
},
@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
@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
#!/bin/bash
# Error handling
function OwnError()
{
echo -e "[ `date` ] $(tput setaf 1)$@$(tput sgr0)"
exit $2
}
# Repository for rethinkdb
{"0":{"topic":"wowbox","partition":0,"message":{"key":1495090367172,"value":"{\"event\":\"client:card:click\",\"properties\":{\"properties_networkStatus\":\"OFFLINE\",\"properties_page\":\"index\",\"properties_google_play_services\":\"available\",\"organization_id\":4,\"device_device_id\":\"f9ca7c01f92b9b4f\",\"device_device_model\":\"Samsung SM-G532F\",\"device_android_version\":\"6.0.1\",\"client_version\":20602,\"client_api_version\":4,\"client_android_version\":\"6.0.1\",\"client_name\":\"Android\",\"experiments_0_name\":\"default\",\"experiments_0_scenarios_0_name\":\"default\",\"experiments_0_scenarios_0_percentage\":100,\"batch_id\":\"2017/05/18/06-52-07.ip-10-87-3-56.txt\",\"card_id\":19458,\"card_name\":\"Aquarius and Libra Compatibility!: Horoscope\",\"card_type\":\"Lifestyle\",\"card_organization_id\":4,\"card_available_from\":\"2017-05-12T05:40:48.000Z\",\"card_available_to\":\"2017-05-19T05:40:00.000Z\",\"card_priority\":4421,\"card_api_version\":1,\"card_subcategory\":\"Horoscope\",\"card_tokens
kstream-demo-66469f7cd5-s85k4 kstream + '[' x = xtrue ']'
kstream-demo-66469f7cd5-s85k4 kstream + exec /docker-java-home/bin/java -Xmx256M -server -XX:+UseG1GC -XX:MaxGCPauseMillis=20 -XX:InitiatingHeapOccupancyPercent=35 -XX:+ExplicitGCInvokesConcurrent -Djava.awt.headless=true -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -javaagent:/java/datadog/dd-java-agent.jar -Ddd.service.name=ingressevent-stream -Ddd.agent.host= -Ddd.agent.port= -cp /java/kafka/kafka-streams-demo-1.0-SNAPSHOT-jar-with-dependencies.jar -Dloggly.api_tokens=xxxxxx com.wowbox.datalake.kafka.streams.IngressEventApp --bootstrapServers kafka-0.kafka-headless:9092,kafka-1.kafka-headless:9092,kafka-2.kafka-headless:9092 --topic wowbox-event-test --schemaRegistryUrl http://ignorance-host:8080
kstream-demo-66469f7cd5-s85k4 kstream Exception in thread "main" java.lang.reflect.InvocationTargetException
kstream-demo-66469f7cd5-s85k4 kstream at sun.reflect.NativeMethodAcces
@nutzhub
nutzhub / boto3-sts
Last active January 16, 2019 08:08
snippet to use sts (temporary credential) to call boto3 api in your machine
#!/usr/bin/env python
import gzip
import io
import boto3
import json
from botocore.exceptions import ClientError
class STS(object):
"""
@nutzhub
nutzhub / clean-up-boot-partition-ubuntu.md
Created February 12, 2019 14:18 — forked from ipbastola/clean-up-boot-partition-ubuntu.md
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
FROM python:3.6-alpine3.6
RUN apk update
RUN apk upgrade
RUN apk add --no-cache git openssh curl
ENV WORK_ENV=DEV
COPY . /api
WORKDIR /api
ADD run.py .
ADD requirements.txt .