Skip to content

Instantly share code, notes, and snippets.

View vishalraina's full-sized avatar
🎯
Focusing

Vishal vishalraina

🎯
Focusing
View GitHub Profile
@vishalraina
vishalraina / .screenrc-main-example
Last active January 4, 2016 19:23 — forked from ChrisWills/.screenrc-main-example
A nice default screenrc
# GNU Screen - main configuration file
# All other .screenrc files will source this file to inherit settings.
# Author: Christian Wills - cwills.sys@gmail.com
# Allow bold colors - necessary for some reason
attrcolor b ".I"
# Tell screen how to set colors. AB = background, AF=foreground
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
@vishalraina
vishalraina / parser.py
Created August 2, 2016 00:12 — forked from JSONOrona/parser.py
Python command line argument example using argparse module
#!/usr/bin/python
''' Python command line argument example using argparse module
Example output:
./parser.py --server=pyserver --port=8080,443,25,22,21 --keyword=pyisgood
Server name: [ pyserver ]
@vishalraina
vishalraina / knife cheat
Created August 9, 2016 01:43 — forked from ipedrazas/knife cheat
Hello!
# knife cheat
## Search Examples
knife search "name:ip*"
knife search "platform:ubuntu*"
knife search "platform:*" -a macaddress
knife search "platform:ubuntu*" -a uptime
knife search "platform:ubuntu*" -a virtualization.system
knife search "platform:ubuntu*" -a network.default_gateway
@vishalraina
vishalraina / gist:ff8f004295bd4b262175cb1b23958889
Created January 23, 2018 21:30
How to Create a local DNS
#Source http://fullybaked.co.uk/articles/setting-up-a-local-dns-server-on-osx
Local DNS
This is my preferred solution. Run a local domain name server on your computer that can resolve all requests for a given top level domain to the localhost, and forward everything else to the Internet as normal.
As with everything I write about this will be specifically aimed at Mac OSX, although you can do the same on Linux as dnsmasq is available. For Windows users I can't recommend or suggest a service but the principles will be the same.
First off, you will need Homebrew the package manager for OSX. I won't retread installation instructions for it, you can get the most current ones from the Homebrew site.
Then follow these steps, which set up dnsmasq so that all domains with a TLD of .loc will point to the localhost
@vishalraina
vishalraina / Rsync over SSH with key authentication
Created April 4, 2018 21:25
Rsync over SSH with key authentication
rsync --progress -avz -e "ssh -i ~/.ssh/id_rsa.pub" /my/rsync/tools/path destinationuser@destinationserver:destinationpath
#Your DB properties goes here
#Logging File location
logging.file=./logs/github.log
#Collector schedule (required)
github.cron=3 * * * * *
github.host=github.com
@vishalraina
vishalraina / api.properties
Created October 9, 2018 03:18
API Properties
#dbname=dashboarddb
#dbport=27017
#dbreplicaset=false
#dbhostport=localhost:27017
#server.contextPath=/api
#server.port=8080
#key=OLXa7OVhKvSYC79AoXnZbZ4muibQQGiw
# api.properties
server.contextPath=/api
#To start API Servers
#!/usr/bin/env bash
cd ~/workspace/Hygieia/api/target/
java -jar api.jar --spring.config.location=apiapplication.properties
#TO start Github collector
#!/usr/bin/env bash
cd ~/workspace/Hygieia/collectors/scm/github/target/
java -jar github-scm-collector-2.0.5-SNAPSHOT.jar --spring.config.name=github --spring.config.location=github.properties
@vishalraina
vishalraina / drain_jenkins.groovy
Created October 29, 2020 18:52 — forked from sasjo/drain_jenkins.groovy
Drain Jenkins build queue and stop all running jobs
Jenkins.instance.queue.items.findAll { !it.task.name.contains("Extenda") }.each {
println "Cancel ${it.task.name}"
Jenkins.instance.queue.cancel(it.task)
}
Jenkins.instance.items.each {
stopJobs(it)
}
def stopJobs(job) {
if (job in jenkins.branch.OrganizationFolder) {
// Git behaves well so no need to traverse it.
import hudson.model.*
def q = Jenkins.instance.queue
q.items.each { q.cancel(it.task) }
Jenkins.instance.queue.items.findAll { !it.task.name.contains("Extenda") }.each {
println "Cancel ${it.task.name}"
Jenkins.instance.queue.cancel(it.task)