Skip to content

Instantly share code, notes, and snippets.

View kokigit's full-sized avatar

kokila alupotha kokigit

  • Student at University of Moratuwa
View GitHub Profile
@kokigit
kokigit / README.md A simple Docker and Docker Compose install script for Ubuntu

A simple Docker and Docker Compose install script for Ubuntu

Usage

  1. sh install-docker.sh
  2. log out
  3. log back in

Links

@kokigit
kokigit / bash script
Created October 29, 2019 12:49
How to know service is running on which node in swarm?
for ITR in $(docker stack ps dockerstack --no-resolve --format '{{.Node}}={{.Image}}'); do echo -e "$(cut -d'=' -f2 <<< ${ITR})" - $(docker node inspect --format '{{.Status.Addr}}' "$(cut -d'=' -f1 <<< ${ITR})"); done
@kokigit
kokigit / self-signed-certificate-with-custom-ca.md
Created January 7, 2019 08:06 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@kokigit
kokigit / remote port forwarding.txt
Last active October 12, 2018 04:49
remote port forwarding serve local web app bypassing NAT, tunnel every connection through your server.
=============================================================================
first allow port 80,443 through inbound security groups(aws ec2)
allow all for outbound 0.0.0.0/0
on server :
forward privilaged ports(Ports below 1024)
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
to delete the above rule:
@kokigit
kokigit / aws.policy
Created June 16, 2018 06:31
allow all s3 actions to bucket and bucket objects IAM policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "myproject",
"Effect": "Allow",
"Action": [
"s3:*"
],
"Resource": [
@kokigit
kokigit / .irbrc
Last active October 18, 2018 09:08
to print rails(ruby) objects as indented(pretty json) json output add this function to ~/.irbrc file(if not exist create one). then it will be loaded with irb or rails console
def pp(obj)
puts JSON.pretty_generate({ "#{obj.class.name.underscore}" => obj }.as_json)
end
# console command
#pp Company.first
#and the output
# {
@kokigit
kokigit / .irbrc
Created May 17, 2018 06:11
to print rails active record objects with indented json out put put this function on ~/.irbrc file. then it will be loaded with irb or rails console
def pp(obj)
puts JSON.pretty_generate({ "#{obj.class.name.underscore}" => obj }.as_json)
end

Keybase proof

I hereby claim:

  • I am kokigit on github.
  • I am alupotha (https://keybase.io/alupotha) on keybase.
  • I have a public key whose fingerprint is 9B0B 7C94 3778 5D50 5201 EAD0 333A 5CC3 CF98 3664

To claim this, I am signing this object:

@kokigit
kokigit / designer.html
Last active August 29, 2015 14:09
designer
<link rel="import" href="../topeka-elements/category-icons.html">
<link rel="import" href="../core-icon/core-icon.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
@kokigit
kokigit / designer.html
Last active August 29, 2015 14:09
designer
<link rel="import" href="../core-drawer-panel/core-drawer-panel.html">
<link rel="import" href="../paper-checkbox/paper-checkbox.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../paper-button/paper-button.html">
<link rel="import" href="../core-icons/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
<polymer-element name="my-element">