Skip to content

Instantly share code, notes, and snippets.

View ashee's full-sized avatar

Amitava Shee ashee

View GitHub Profile
@ashee
ashee / 1 - qemu commands
Created January 31, 2021 11:12 — forked from aserhat/0 - setup
QEMU and HVF
#Static Builds
## Creata disk
qemu-img create -f qcow2 server1.img 10G
## Install the OS onto the disk
qemu-system-x86_64 -M accel=hvf --cpu host -hda server1.img -cdrom ubuntu-18.04.2-live-server-amd64.iso -boot d -m 2048
## Boot the server
qemu-system-x86_64 -M accel=hvf --cpu host server1.img -m 2048
@ashee
ashee / install_openresty_in_mac.md
Last active February 17, 2018 04:48 — forked from ejlp12/install_openresty_in_mac.md
Install openresty in Mac OS-X

Install 3scale self managed API gateway (openresty) in Mac OS-X

brew update
brew install pcre openssl

wget http://openresty.org/download/ngx_openresty-1.9.7.2.tar.gz
tar xzvf ngx_openresty-1.9.7.2.tar.gz
cd ngx_openresty-1.9.7.2

There are four different ways one can deploy a webapp to Tomcat.
If $TOMCAT_HOME is the Tomcat top-level directory:

  • Copy the war file foo.war or exploded war directory to $TOMCAT_HOME/webapps
  • Create a context file context.xml in the webapp’s META-INF/ directory that contains a fragment that describes the webapp deployment
  • Add a <Context> element to the <Host> element in Tomcat’s server.xml that describes the webapp deployment, including docBase. docBase is a attribute that locates the war file or exploded war directory in the filesystem.
  • Create a context file foo.xml in $TOMCAT_HOME/conf/Catalina/localhost/foo.xml that contains a fragment that describes the webapp deployment, including docBase.

Sample $TOMCAT_HOME/conf/Catalina/localhost/foo.xml

@ashee
ashee / datasource-template.cli
Created May 4, 2016 14:35 — forked from ehsanullahjan/datasource-template.cli
Templates for creating PostgreSQL, SQL Server, Oracle and MySQL datasources in JBoss / WildFly using JBoss CLI
# PostgreSQL
/subsystem=datasources/data-source={{data-source-name}}:add(jndi-name="{{jndi-name}}",driver-name="postgres",connection-url="{{jdbc-uri}}",user-name={{username}},password={{password}},enabled=true,use-java-context=true,background-validation=false,validate-on-match=true,valid-connection-checker-class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker",exception-sorter-class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter",min-pool-size=1,max-pool-size=10,idle-timeout-minutes=3)
# SQL Server
/subsystem=datasources/data-source={{data-source-name}}:add(jndi-name="{{jndi-name}}",driver-name="sqlserver",connection-url="{{jdbc-uri}}",user-name={{username}},password={{password}},enabled=true,use-java-context=true,background-validation=false,validate-on-match=true,valid-connection-checker-class-name="org.jboss.jca.adapters.jdbc.extensions.mssql.MSSQLValidConnectionChecker",min-pool-size=1,max-pool-size=10,idle-timeout-minutes=3)
# Oracl
@ashee
ashee / register-jdbc-drivers.cli
Created May 4, 2016 14:35 — forked from ehsanullahjan/register-jdbc-drivers.cli
Snippets for enabling JDBC drivers, deployed as modules, in JBoss / Wildfly using JBoss CLI
# PostgreSQL
/subsystem=datasources/jdbc-driver=postgres:add(driver-name=postgres,jdbc-compliant=true,driver-module-name=org.postgres.jdbc,driver-class-name=org.postgresql.Driver,driver-datasource-class-name=org.postgresql.ds.PGPoolingDataSource,xa-datasource-class=org.postgresql.xa.PGXADataSource)
# SQL Server
/subsystem=datasources/jdbc-driver=sqlserver:add(driver-name=sqlserver,jdbc-compliant=true,driver-module-name=org.jtds.jdbc,driver-class-name=net.sourceforge.jtds.jdbc.Driver,driver-datasource-class-name=net.sourceforge.jtds.jdbcx.JtdsDataSource,xa-datasource-class=net.sourceforge.jtds.jdbcx.JtdsDataSource)
# Oracle
/subsystem=datasources/jdbc-driver=oracle:add(driver-name=oracle,jdbc-compliant=true,driver-module-name=com.oracle.jdbc,driver-class-name=oracle.jdbc.OracleDriver,driver-datasource-class-name=oracle.jdbc.pool.OracleDataSource,xa-datasource-class=oracle.jdbc.xa.OracleXADataSource)
# MySQL
@ashee
ashee / GIF-Screencast-OSX.md
Created April 17, 2016 20:35 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@ashee
ashee / bootstrapCDN.html
Last active December 16, 2015 11:39 — forked from planetoftheweb/bootstrapCDN.html
Bootstrap 3 CDN Page Code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<!-- IE Edge Meta Tag -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Viewport -->
# ==============================================================
# 10.10 How to make an ISO from the Install.app
# ==============================================================
# Mount the installer image. It assumes that the installation app is called "Install OS X Yosemite.app"
# located in your "Applications" folder. If not, change the first command accordingly.
# you are expected to prepare /System/Library/Kernels/kernel at this stage
# kernel can be extracted from InstallESD.dmg/Packages/Essentials.pkg/System/Library/Kernels/kernel with Pacifist
PATH_TO_KERNEL=kernel
@ashee
ashee / simplevpn
Last active September 11, 2015 06:58 — forked from vi/simplevpn
simplevpn: Simple IPsec and ipip[6] tunnel configuration for Linux using SSH for key exchange
#!/bin/bash
# Setup encrypted IPv4 tunnel over IPv4 or IPv6 on two Linux nodes using SSH for tunnel setup.
# Requires only ipsec-tools, iproute2, ssh and necessry kernel modules locally and remotely.
# Warning: it flushes IPsec settings both locally and remotely.
# Don't use with other IPsec tunnnels.
# Sample usage:
# simplevpn -6 fc::1 fc::2 ssh -T root@fc::2
@ashee
ashee / libreswan_setup.sh
Last active August 29, 2015 14:25 — forked from rosstimson/libreswan_setup.sh
Libreswan VPN setup script.
#!/bin/bash -ex
# Set some local variables
PRIVATE_IP=`curl -s http://169.254.169.254/latest/meta-data/local-ipv4`
PUBLIC_IP=`curl -s http://169.254.169.254/latest/meta-data/public-ipv4`
VPN_DNSHOST=`grep -o "nameserver.*" /etc/resolv.conf | awk '{print $2}'`
yum install -y libreswan ppp xl2tpd
# Setup IPSEC Tunnel