Skip to content

Instantly share code, notes, and snippets.

@kknd22
kknd22 / linux bash network script port status
Last active July 16, 2019 12:30
linux-bash-network.sh
# https://www.binarytides.com/linux-ss-command/
# https://www.computerhope.com/unix/nc.htm
# show only the listening sockets (To get the output faster, use the "n" option to prevent ss from resolving ip addresses to hostnames)
ss -ltpn
ss -ltn
# test the connetion (netcat)
# "r" means report not connect
@kknd22
kknd22 / Vagrantfile
Last active April 27, 2018 18:09 — forked from garethrees/Vagrantfile
Example Ansible Delegation
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = '2'
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = 'centos6'
config.vm.box_url = 'http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130731.box'
config.vm.boot_timeout = 60
@kknd22
kknd22 / kafka-ternimal.sh
Created January 15, 2018 19:37
kafka bash alias bash script
kf_dir=~/sw/kafka_2.11-1.0.0
echo "...starting zookeeper..."
gnome-terminal --title="zookeeper" --geometry 80x30+1+1 \
-e "$kf_dir/bin/zookeeper-server-start.sh $kf_dir/config/zookeeper.properties"
echo "...waiting for 5 sec..."
sleep 5
echo "...starting kafka broker 0..."
@kknd22
kknd22 / process-port.sh
Last active December 13, 2017 19:08
Linux: Find Out Which Process Is Listening Upon a Port
sudo netstat -tulpn | grep 9092
tcp 0 0 0.0.0.0:9092 0.0.0.0:* LISTEN 4484/java
sudo cat /proc/4484/cmdline
@kknd22
kknd22 / aws-cli-s3-create-bucket.sh
Created November 3, 2017 13:59
aws-cli-s3-create-bucket.sh fakes3
aws s3api create-bucket --bucket e1-dev-local-dddd-bucket1 --region us-east-1 --endpoint-url http://localhost:7373
aws s3api create-bucket --bucket e1-dev-local-dddd-bucket2 --region us-east-1 --endpoint-url http://localhost:7373
aws s3api list-buckets --region us-east-1 --endpoint-url http://localhost:7373
@kknd22
kknd22 / MyAwsCrudS3.scala
Created November 3, 2017 13:56
scala code crud for aws s3 - fakes3
package junk
import com.amazonaws.{AmazonClientException, AmazonServiceException, ClientConfiguration}
import com.amazonaws.auth.{AWSStaticCredentialsProvider, BasicAWSCredentials}
import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration
import com.amazonaws.services.s3.{AmazonS3Client, AmazonS3ClientBuilder, S3ClientOptions}
import com.amazonaws.services.s3.model.Bucket
import scala.collection.JavaConversions._
import com.amazonaws.services.s3.model.PutObjectRequest
@kknd22
kknd22 / scala+T-T
Last active January 5, 2017 20:52
scala +T -T convariance contravariance
http://blogs.atlassian.com/2013/01/covariance-and-contravariance-in-scala/
trait Function1[-T1, +R] {
def apply(t : T1) : R
...
}
This is single arg function in scala - T1 is basically input, R is output.
Any single arg function extends from this. And think through this rationally:
-T1 -> input needs to be less restrictive
@kknd22
kknd22 / scala self explaination
Last active December 22, 2016 15:41
scala self
http://www.scala-lang.org/old/node/8194.html
http://stackoverflow.com/questions/4017357/difference-between-this-and-self-in-self-type-annotations
3 forms:
trait A {self: B =>..}
trait A {self =>..}
trait A {this: B =>..}
trait A {self: B =>..} is the most useful one. used primary for mixins.
'A' implements a small groups of very specific operations for very generic type. 'B' could be potentially implements another a small group.
@kknd22
kknd22 / scala-symbols.txt
Created December 21, 2016 19:52
scala symbol operator
// Keywords
<- // Used on for-comprehensions, to separate pattern from generator
=> // Used for function types, function literals and import renaming
// Reserved
( ) // Delimit expressions and parameters
[ ] // Delimit type parameters
{ } // Delimit blocks
. // Method call and path separator
// /* */ // Comments
@kknd22
kknd22 / 0_reuse_code.js
Created April 18, 2016 13:09
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console