Skip to content

Instantly share code, notes, and snippets.

View amitkrishna's full-sized avatar
🍁
Eye of the Tiger

Amit Krishna amitkrishna

🍁
Eye of the Tiger
View GitHub Profile
def two_fer(name = ''):# siting default argument as ''
#name!=''?print('One for '+name+',one for me'):print('One for you , one for me');
if name!='':
#print('One for',name,', one for me')
# print(f"One for {name}, one for me")
f"One for {name}, one for me"
else:
f"One for you, one for me"
#print('One for you , one for me')
@amitkrishna
amitkrishna / index.js
Created August 16, 2020 12:43
Onemonth JS for Todo List
$(document).ready(function () {
// YOUR CODE HERE!
$(".add-items").submit(function ( $event ){
$event.preventDefault();
var item = $("#todo-list-item").val();
console.log($("#todo-list-item").val());
console.log(typeof(item));
console.log(typeof(item.val));// undefined
if (Boolean(item.val)) {// run only if condition is true
console.log(Boolean(item.val));// gets the value of the item
@amitkrishna
amitkrishna / irc.md
Created October 30, 2020 14:53 — forked from xero/irc.md
irc cheat sheet

IRC Reference

Not intended as a guide for newbies, more like a "cheat sheet" for the somewhat experienced IRC user, especially one who wields some power over a channel.

The Basics

  • /join #channel
    • Joins the specified channel.
  • /part #channel
  • Leaves the specified channel.
*,
*:before,
*:after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
background-color: #1d1f20;
@amitkrishna
amitkrishna / GoogleDorking.md
Created December 11, 2020 06:33 — forked from sundowndev/GoogleDorking.md
Google dork cheatsheet

Google dork cheatsheet

Search filters

Filter Description Example
allintext Searches for occurrences of all the keywords given. allintext:"keyword"
intext Searches for the occurrences of keywords all at once or one at a time. intext:"keyword"
inurl Searches for a URL matching one of the keywords. inurl:"keyword"
allinurl Searches for a URL matching all the keywords in the query. allinurl:"keyword"
intitle Searches for occurrences of keywords in title all or one. intitle:"keyword"
@amitkrishna
amitkrishna / ajax_cheat_sheet.md
Created January 15, 2021 11:52 — forked from joelrojo/ajax_cheat_sheet.md
AJAX 101 cheat sheet

#AJAX

What is AJAX

"AJAX an acronym for asynchronous JavaScript and XML is a group of interrelated web development techniques used on the client-side to create asynchronous web applications. With Ajax, web applications can send data to, and retrieve data from, a server asynchronously (in the background) without interfering with the display and behavior of the existing page. Data can be retrieved using the XMLHttpRequest object. Despite the name, the use of XML is not required (JSON is often used instead), and the requests do not need to be asynchronous." - wikipedia

AJAX with jQuery

jQuery provides a $.ajax() method with a set of options for sending requests and callback methods to handle responses.

  • Here is the most basic $.ajax() request that does not send any data. It will be handled by the post '/trips' route on the server. You can choose any of the http request verbs for the type parameter (get, post, put, delete)
@amitkrishna
amitkrishna / eks.sh
Created February 1, 2021 09:31 — forked from vfarcic/eks.sh
# Source: https://gist.github.com/be32717b225891b69da2605a3123bb33
####################
# Create a cluster #
####################
# Follow the instructions from https://github.com/weaveworks/eksctl to intall eksctl if you do not have it already
export AWS_ACCESS_KEY_ID=[...] # Replace [...] with the AWS Access Key ID
# Source: https://gist.github.com/419032bc714cc31cd2f72d45ebef07c7
######################
# Creating A Cluster #
######################
# Docker Desktop: https://gist.github.com/f753c0093a0893a1459da663949df618 (docker.sh)
# Minikube: https://gist.github.com/ddc923c137cd48e18a04d98b5913f64b (minikube.sh)
# GKE: https://gist.github.com/2351032b5031ba3420d2fb9a1c2abd7e (gke.sh)
# EKS: https://gist.github.com/be32717b225891b69da2605a3123bb33 (eks.sh)
@amitkrishna
amitkrishna / k8s_cli_hacks
Last active December 14, 2022 09:35
k8s cli hacks
- Customized Column output
$>kubectl get pods -A -o custom-columns=NAMESPACE:.metadata.namespace,NAME:.metadata.name,NODE:.spec.nodeName,HOSTIP:.status.hostIP,PHASE:.status.phase,START_TIME:.metadata.creationTimestamp --sort-by=.metadata.creationTimestamp
- Delete taint from K8s clusters
$> kubectl patch node node1.compute.internal -p '{"spec":{"taints":[]}}'
$> kubectl get nodes -o json | jq '.items[].spec'