Skip to content

Instantly share code, notes, and snippets.

View ranjitiyer's full-sized avatar
🎯
Focusing

Ranjit ranjitiyer

🎯
Focusing
  • Amazon
  • Irvine CA
View GitHub Profile
@ranjitiyer
ranjitiyer / sh
Created April 11, 2018 17:33
Linux Administration
#
# Source https://www.linuxtrainingacademy.com/linux-commands-cheat-sheet/
#
– SYSTEM INFORMATION
# Display Linux system information
uname -a
# Display kernel release information
uname -r
basic 'find file' commands
--------------------------
find / -name foo.txt -type f -print # full command
find / -name foo.txt -type f # -print isn't necessary
find / -name foo.txt # don't have to specify "type==file"
find . -name foo.txt # search under the current dir
find . -name "foo.*" # wildcard
find . -name "*.txt" # wildcard
find /users/al -name Cookbook -type d # search '/users/al' dir
@ranjitiyer
ranjitiyer / elastic-search-queries
Last active November 15, 2017 20:29
Elastic Search Cheat Sheet
# Delete docs that do not exactly match a phrase
POST audiobooks/book/_delete_by_query
{
"query": {
"bool": {
"must_not": [
{"match_phrase": {
"language": "English"
}}
]
@ranjitiyer
ranjitiyer / pom.xml
Created November 10, 2017 22:19
Create Maven fat jar
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.amazon</groupId>
<artifactId>spark</artifactId>
<version>1.0-SNAPSHOT</version>
@ranjitiyer
ranjitiyer / spiritualQuote.js
Created November 6, 2017 18:36
Alexa skill for your daily spiritual quote
/* eslint-disable func-names */
/* eslint-disable dot-notation */
/* eslint-disable new-cap */
/* eslint quote-props: ['error', 'consistent']*/
/**
* This sample demonstrates a simple skill built with the Amazon Alexa Skills
* nodejs skill development kit.
* This sample supports en-US lauguage.
* The Intent Schema, Custom Slots and Sample Utterances for this skill, as well
* as testing instructions are located at https://github.com/alexa/skill-sample-nodejs-trivia
public class ExceptionUtils {
public static String stackTraceAsString(Exception ex) {
if (ex == null) {
return "";
}
return Arrays.asList(ex.getStackTrace())
.stream()
.reduce(
new StringBuilder(),
/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
public static void main (String[] args) throws java.lang.Exception