Skip to content

Instantly share code, notes, and snippets.

View visuddha's full-sized avatar
💭
Doing Stuff 👍

Visuddha Karunaratne visuddha

💭
Doing Stuff 👍
View GitHub Profile
@visuddha
visuddha / app.js
Created July 4, 2022 06:50 — forked from jgoux/app.js
Ionic / AngularJS service wrapper for Web SQL API / SQLite-Cordova-Plugin
angular.module('myApp', ['ionic', 'myApp.services', 'myApp.controllers'])
.run(function(DB) {
DB.init();
});
@visuddha
visuddha / install_pig
Created June 22, 2022 06:34 — forked from ruanyl/install_pig
install and setup pig in macos
This gist assuming that you have apahce hadoop installed and running.
step to install and config pig:
>1. brew install pig
>2. export JAVA_HOME="$(/usr/libexec/java_home)"
>3. export PIG_CLASSPATH=/path/to/pig.jar, normally if you install pig via homebrew, the path should be like:/usr/local/Cellar/pig/0.13.0/pig-0.13.0-h1.jar
step 2 & 3 are mandatory for me, otherwise *pig* wont work.
@visuddha
visuddha / stress.sh
Last active July 30, 2021 14:20 — forked from mikepfeiffer/stress.sh
Install Stress Utility on Amazon Linux 2
sudo amazon-linux-extras install epel -y
sudo yum install stress -y
## running
sudo stress --cpu  8 --timeout 200

Installation

1)

brew install nginx
sudo cp /usr/local/Cellar/nginx/1.8.0/homebrew.mxcl.nginx.plist /Library/LaunchAgents

2)

Replace /usr/local/etc/nginx/nginx.conf with the nginx.conf in this gist. I'm using port 5000 for my current project. Obviously, change server_name as well, and probably the name of its access log.

# 1. Install nginx
brew install nginx
# 2. Generate self-signed key/crt
openssl req -x509 -nodes -days 365 -newkey rsa:1024 \
-keyout /etc/ssl/private/myssl.key \
-out /etc/ssl/certs/myssl.crt
# 3. Edit nginx config located at: /usr/local/etc/nginx/nginx.conf
server {

Sometimes you want to retrieve EC2 insntances' region information.

You can query that information through instance metadata(169.254.169.254).

$ curl --silent http://169.254.169.254/latest/dynamic/instance-identity/document
{
  "privateIp" : "172.31.2.15",
  "instanceId" : "i-12341ee8",
  "billingProducts" : null,
 "instanceType" : "t2.small",
@visuddha
visuddha / CouchDB_Python.md
Created April 15, 2021 07:41 — forked from marians/CouchDB_Python.md
The missing Python couchdb tutorial

This is an unofficial manual for the couchdb Python module I wish I had had.

Installation

pip install couchdb

Importing the module

1. Use openssl
openssl smime -in /path/to/your.mobileprovision -inform der -verify
2. Use security command
security cms -Di /path/to/your.mobileprovision
*.iml
.gradle
/local.properties
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
.DS_Store
/build
/captures
.externalNativeBuild