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
# For macOS users (copy & paste all or one commands at a time)
# Last tested Slack version: 4.0.2
$ git clone https://github.com/LanikSJ/slack-dark-mode && \
cd slack-dark-mode && \
chmod +x slack-dark-mode.sh && \
./slack-dark-mode.sh && \
osascript -e 'tell application "Slack" to quit' && \
killall Slack && \
sleep 20 && \
open -a "/Applications/Slack.app"
@sbp
sbp / json2yaml.sh
Created May 22, 2011 21:00
Convert JSON to YAML
#!/bin/sh
export PYTHONPATH=$HOME/usr/opt/pyyaml/lib/python2.6/site-packages
python -c '
import sys, json, yaml
with open(sys.argv[1]) as f:
print yaml.safe_dump(json.load(f), default_flow_style=False)
' $@
kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml
kubectl get pods --namespace kube-system
kubectl port-forward kubernetes-dashboard-5569448c6d-jxbhv 8443:8443 --namespace=kube-system
git clone https://github.com/dockersamples/k8s-wordsmith-demo
cd k8s-wordsmith-demo
docker-compose build
kubectl apply -f kube-deployment.yml
@rednafi
rednafi / staticmeta.py
Last active September 9, 2020 10:24
Metaclass to apply staticmethod decorator to all the methods of a class
from types import FunctionType
class StaticMeta(type):
def __new__(cls, name, bases, attrs):
"""Metaclass to apply staticmethod decorator to all the methods."""
new_cls = super().__new__(cls, name, bases, attrs)
# key is attribute name and val is attribute value in the attrs dict
for key, val in attrs.items():
@dblock
dblock / getWeek.js
Created July 13, 2011 22:49
get week of the year in JavaScript
function( d ) {
// Create a copy of this date object
var target = new Date(d.valueOf());
// ISO week date weeks start on monday
// so correct the day number
var dayNr = (d.getDay() + 6) % 7;
// Set the target to the thursday of this week so the
@gmlp
gmlp / 03-pod.sh
Created December 28, 2017 21:26 — forked from vfarcic/03-pod.sh
minikube start --vm-driver=virtualbox
kubectl get nodes
git clone https://github.com/vfarcic/k8s-specs.git
cd k8s-specs
kubectl run db --image mongo
@gopalanand333
gopalanand333 / readUIEvents.js
Last active March 15, 2021 11:12
This script reads all the clicks done on a webpage's body, and pushing it into an array, a service is called where this array holding click related information can be pushed. There's a check for the length of array and if there is no event the service call is canceled. This gives the user of this script a privilege to understand the usage patter…
var myEventList = [];
function writeData() {
document.body.onclick = function(event) {
myEventList.push(formatData(event));
};
function formatData(data) {
var event = [];
event.push({
"x": data.clientX,
"y": data.clientY,
@sangam14
sangam14 / docker-compose.yml
Last active January 9, 2022 23:55
PDC_Treafik.md
version: "3.3"
services:
################################################
#### Traefik Proxy Setup #####
###############################################
traefik:
image: traefik:v2.3
restart: always
# Source: https://gist.github.com/d860631d0dd3158c32740e9260c7add0
minikube start --vm-driver=virtualbox
kubectl get nodes
git clone https://github.com/vfarcic/k8s-specs.git
cd k8s-specs
kubectl get services # List all services
kubectl get pods # List all pods
kubectl get nodes -w # Watch nodes continuously
kubectl version # Get version information
kubectl cluster-info # Get cluster information
kubectl config view # Get the configuration
kubectl describe node <node> # Output information about a node
kubectl get pods # List the current pods
kubectl describe pod <name> # Describe pod <name>
kubectl get rc # List the replication controllers