Skip to content

Instantly share code, notes, and snippets.

View Rahulsharma0810's full-sized avatar
🏠
Working from home

Rahul sharma Rahulsharma0810

🏠
Working from home
View GitHub Profile
@Rahulsharma0810
Rahulsharma0810 / Remove-Blank-lines-in-files-from-dir.py
Created November 9, 2021 07:44
Script to remove blank lines from files in a directory
import os
files = os.listdir(os.curdir)
OUTPUT = ""
for file in files:
with open(file, encoding='utf-8') as f:
for line in f:
if not line.isspace():
@Rahulsharma0810
Rahulsharma0810 / move-files-subdir-to-maindir.py
Created November 2, 2021 05:53
move-files-subdir-to-maindir
import shutil
import os
SOURCE= r'PATHA'
DESTINATION = r'PATHB'
for path, subdirs, files in os.walk(SOURCE):
for name in files:
filename = os.path.join(path, name)
print(filename)
@Rahulsharma0810
Rahulsharma0810 / web.php
Created July 13, 2020 11:23
Luman Sample API Methods
$router->get('/', function () use ($router) {
return $router->app->version();
});
$router->get('products', function () use ($router) {
return response(['Product 1', 'Product 2', 'Product 3'],200);
});
$router->post('status', function() {
return response()->json([
@Rahulsharma0810
Rahulsharma0810 / jenkins-waituntil-curl-jq
Created July 2, 2020 21:30
Jenkins stage to get grep text on http endpoint
import groovy.io.FileType
/* groovylint-disable-next-line CompileStatic */
pipeline {
agent {
label ''
}
stages {
stage('1') {
steps {
@Rahulsharma0810
Rahulsharma0810 / terrafrom.tf
Created April 30, 2020 14:07
terraform remote state file bucket
terraform {
backend "gcs" {
bucket = "bucket-ops-example"
prefix = "terraform/state"
}
}
@Rahulsharma0810
Rahulsharma0810 / mysqldump-docker.sh
Last active April 15, 2020 11:39 — forked from spalladino/mysql-docker.sh
Backup a mysql database from a running Docker mysql container
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
apiVersion: v1
kind: ReplicationController
metadata:
name: nginx
spec:
replicas: 3
selector:
app: nginx ##Must BE same to template/metadata/labels/app
template:
metadata:
# https://kubernetes.io/docs/tutorials/k8s201/
# https://cheatsheet.dennyzhang.com/kubernetes-yaml-templates
apiVersion: v1
kind: Pod
metadata:
name: pod-with-http-healthcheck
spec:
containers:
- name: nginx
image: nginx