Skip to content

Instantly share code, notes, and snippets.

View Shashwatsh's full-sized avatar

Shashwat Shagun Shashwatsh

View GitHub Profile
from Xlib import X, display
class Window:
def __init__(self, display, msg):
self.display = display
self.msg = msg
self.screen = self.display.screen()
self.window = self.screen.root.create_window(
10, 10, 100, 100, 1,
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | sudo tee /etc/apt/sources.list.d/google-chrome.list
sudo apt-get update
sudo apt-get install google-chrome-stable
yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
yum install docker-ce
@Shashwatsh
Shashwatsh / test.yaml
Last active April 9, 2018 22:18
k8s prom grafana testing
apiVersion: v1
kind: Pod
metadata:
name: shell-demo
annotations:
prometheus.io/scrape: "true"
spec:
volumes:
- name: shared-data
emptyDir: {}
create VMs
git clone https://github.com/kubernetes-incubator/kargo.git
cd kargo
cp ~/inventory.cfg inventory/.
vi inventory.cfg
(copy IPs and save)
date
ansible-playbook -u centos -b -i inventory/inventory.cfg cluster.yml
date (show elapsed time)
-- Logs begin at Sun 2017-07-30 13:58:31 UTC, end at Sun 2017-07-30 19:58:25 UTC. --
Jul 30 19:57:25 fedora-1gb-blr1-01.localdomain kube-scheduler[18743]: E0730 19:57:25.001514 18743 reflector.go:201] k8s.io/kubernetes/pkg/client/informers/informers_generated/externalversions/factory.go:70: Failed to list *v1beta1.ReplicaSet: Get http://127.0.0.1:8080/apis/extensions/v1beta1/replicasets?resourceVersion=0: dial tcp 127.0.0.1:8080: getsockopt: connection refused
Jul 30 19:57:25 fedora-1gb-blr1-01.localdomain kube-scheduler[18743]: E0730 19:57:25.002685 18743 reflector.go:201] k8s.io/kubernetes/plugin/pkg/scheduler/factory/factory.go:451: Failed to list *v1.Pod: Get http://127.0.0.1:8080/api/v1/pods?fieldSelector=spec.nodeName%3D%2Cstatus.phase%21%3DFailed%2Cstatus.phase%21%3DSucceeded&resourceVersion=0: dial tcp 127.0.0.1:8080: getsockopt: connection refused
Jul 30 19:57:25 fedora-1gb-blr1-01.localdomain kube-scheduler[18743]: E0730 19:57:25.003855 18743 reflector.go:201] k8s.io/kubernetes/plugin/pkg/sche
@Shashwatsh
Shashwatsh / golang-tls.md
Created June 9, 2017 07:08 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples

Moved to git repository: https://github.com/denji/golang-tls

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@Shashwatsh
Shashwatsh / boid.js
Created April 18, 2017 15:05 — forked from brannondorsey/boid.js
Butterfly Habitat in Three.js
// by Joshua Koo @BlurSpline !!! http://www.joshuakoo.com/
// http://www.lab4games.net/zz85/blog/2013/12/30/webgl-gpgpu-and-flocking-part-1/
var Boid = function() {
var vector = new THREE.Vector3(),
_acceleration, _width = 500, _height = 500, _depth = 200, _goal, _neighborhoodRadius = 100,
_maxSpeed = 4, _maxSteerForce = 0.1, _avoidWalls = false;
this.position = new THREE.Vector3();
@Shashwatsh
Shashwatsh / README.md
Created April 4, 2017 20:47 — forked from oodavid/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@Shashwatsh
Shashwatsh / recover_source_code.md
Created March 17, 2017 14:19 — forked from simonw/recover_source_code.md
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb