Skip to content

Instantly share code, notes, and snippets.

@muniu
muniu / App.java
Created November 26, 2019 07:30 — forked from wrschneider/App.java
Spring Boot listener for Amazon SQS
package bill.boottest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.aws.messaging.listener.annotation.SqsListener;
import com.fasterxml.jackson.annotation.JsonCreator;

Keybase proof

I hereby claim:

  • I am muniu on github.
  • I am muniukariuki (https://keybase.io/muniukariuki) on keybase.
  • I have a public key ASBPCHPB6WUjHbbLvYIP3lcsZ0csmOPBzG6bHGqRwA-22Ao

To claim this, I am signing this object:

@muniu
muniu / ipsec-monitor.sh
Created June 14, 2018 07:15 — 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
@muniu
muniu / Mac SSH Autocomplete
Last active June 12, 2018 06:17 — forked from aliang/Mac SSH Autocomplete
Add auto complete to your ssh, put into your .bash_profile
_complete_ssh_hosts ()
{
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
comp_ssh_hosts=`cat ~/.ssh/known_hosts | \
cut -f 1 -d ' ' | \
sed -e s/,.*//g | \
grep -v ^# | \
uniq | \
grep -v "\[" ;
@muniu
muniu / README.md
Created June 12, 2018 06:17 — forked from magnetikonline/README.md
OS X - SSH client autocomplete for hosts.

OS X SSH client autocomplete for hosts

Snippet for ~/.bash_profile, adding hostname autocomplete to ssh.

Extracts host hints from both ~/.ssh/config and /etc/hosts.

function _completeSSHHosts {

	COMPREPLY=()
	local currentWord=${COMP_WORDS[COMP_CWORD]}
@muniu
muniu / tomcat8.sh
Created June 5, 2018 09:04 — forked from boniface/tomcat8.sh
Tomcat 8 startup Scrpt for Ubuntu
#Create Group
# groupadd tomcat
# useradd -g tomcat -d /usrlocal/tomcat8 tomcat
# usermod -G www-data tomcat
# chown tomcat:tomcat /usrlocal/tomcat8 -R
# vim /etc/init.d/tomcat
#!/bin/sh
@muniu
muniu / gist:0ac68421d36a03f3dd93bbd6bfe9d704
Created March 2, 2018 09:20 — forked from Atem18/gist:4696071
Tutorial to seting up a django website in production.

******************************************************************** Set up Django, Nginx and Gunicorn in a Virtualenv controled by Supervisor********************************************************************

Steps with explanations to set up a server using:

  • Virtualenv
  • Virtualenvwrapper
  • Django
  • Gunicorn
@muniu
muniu / new_ubuntu_server_setup.txt
Created March 10, 2016 11:58 — forked from pkarunyu/new_ubuntu_server_setup.txt
New Ubuntu server setup task list
Server Tasks
1. Change root password
2. Change ssh port (assume to be 4444)
nano /etc/ssh/sshd_config(change port to between 1025 and 65536)
PermitRootLogin no
service ssh restart
ssh -p 4444 demo@SERVER_IP_ADDRESS
@muniu
muniu / workflows-in-django.md
Last active September 17, 2015 08:42 — forked from Nagyman/workflows-in-django.md
Workflows in Django

Workflows (States) in Django

I'm going to cover a simple, but effective, utility for managing state and transitions (aka workflow). We often need to store the state (status) of a model and it should only be in one state at a time.

Common Software Uses

  • Publishing (Draft->Approved->Published->Expired->Deleted)
@muniu
muniu / frag32.py
Last active September 10, 2015 06:30 — forked from ryancdotorg/frag32.py
A FAT32 fragmenter, because I am a horrible person.
#!/usr/bin/env python
import random
import struct
import sys
# Most of the Fat32 class was cribbed from https://gist.github.com/jonte/4577833
def ppNum(num):
return "%s (%s)" % (hex(num), num)