Skip to content

Instantly share code, notes, and snippets.

local random = math.random
local function uuid()
local template ='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
return string.gsub(template, '[xy]', function (c)
local v = (c == 'x') and random(0, 0xf) or random(8, 0xb)
return string.format('%x', v)
end)
end
@sunnykrGupta
sunnykrGupta / .fonts.conf
Created February 1, 2017 07:46
Improve rendering in debian 8
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="font">
<edit name="antialias" mode="assign"><bool>true</bool></edit>
</match>
<match target="font">
<edit name="hintstyle" mode="assign"><const>hintnone</const></edit>
</match>
<match target="font">
@sunnykrGupta
sunnykrGupta / donwload-files.py
Last active February 1, 2017 07:46
Download-files. Feed link in given input files which u wanted to download irrespective of source.
import wget
import os
# Get the list of all the files in current directory
files = [f for f in os.listdir('.') if os.path.isfile(f)]
# Read from file. File contains list of links. All links in new line.
links = open("inputurl.in", "r")
i = 0
@sunnykrGupta
sunnykrGupta / centos_python.sh
Created February 1, 2017 11:55 — forked from selfboot/centos_python.sh
CentOS 6.8: Install Python 2.7.10, pip, virtualenv, and virtualenvwrapper on CentOS
#!/bin/bash
# According to:
# How To Set Up Python 2.7.6 and 3.3.3 on CentOS 6.4
# https://www.digitalocean.com/community/tutorials/how-to-set-up-python-2-7-6-and-3-3-3-on-centos-6-4
yum -y update
yum groupinstall -y 'development tools'
yum install -y zlib-dev openssl-devel sqlite-devel bzip2-devel
yum install xz-libs
wget http://www.python.org/ftp/python/2.7.10/Python-2.7.10.tar.xz
#sample-deployment.yaml
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 3
template:
metadata:
###### cat sample-services.yaml
kind: Service
apiVersion: v1
metadata:
name: my-service
spec:
type: LoadBalancer
loadBalancerIP: 10.10.10.1
ports:
## To view Nodes in a cluster
$kubectl get nodes
NAME STATUS AGE
gke-test-cluster-default-pool-2d123aa1-012f Ready 2d
gke-test-cluster-default-pool-2d123aa1-e23k Ready 2d
## To view the Deployment we created run:
$ kubectl get deployments
Convention
# RAM : Mi = MB, ie, 1024Mi is 1024 MB or 1GB
# CPU : m = milicpu , ie, 100m cpu is 100 milicpu, or say 0.1 CPU
apiVersion: v1
kind: Pod
metadata:
name: cpu-ram-demo
spec:
containers:
#-------------- Node selector example
apiVersion: v1
kind: Pod
metadata:
name: nginx
labels:
env: test
spec:
containers:
I have three file in my directory named 'flask' :
➜ flask
── app.py
── Dockerfile
── requirement.txt
#----------------------------------------------
$ cat app.py