Skip to content

Instantly share code, notes, and snippets.

View yash1th's full-sized avatar
💭
I may be slow to respond.

yash yash1th

💭
I may be slow to respond.
View GitHub Profile
@yash1th
yash1th / docker-macos-terraform.md
Created April 28, 2020 04:35 — forked from brianshumate/docker-macos-terraform.md
The Simplest Terraform with Docker on macOS

If you'd like to experiment with Terraform on macOS locally, a great provider for doing so is the Docker provider. You can get set up in a few simple steps, like so:

1. Install Docker

Install Docker for Mac if you have not already.

@yash1th
yash1th / mv.sh
Created April 13, 2020 21:54 — forked from premek/mv.sh
Rename files in linux / bash using mv command without typing the full name two times
# Put this function to your .bashrc file.
# Usage: mv oldfilename
# If you call mv without the second parameter it will prompt you to edit the filename on command line.
# Original mv is called when it's called with more than one argument.
# It's useful when you want to change just a few letters in a long name.
function mv() {
if [ "$#" -ne 1 ]; then
command mv "$@"
return

Generate a certificate

Note: Git Bash comes with OpenSSL

$ openssl req -x509 -new -newkey rsa:4096 -sha256 -days 730 -nodes -out freenode.pem -keyout freenode.pem
Generating a 4096 bit RSA private key
.....................................................++
............................................................................++
writing new private key to 'freenode.pem'
import sys
debug = True
def exceptionHandler(exception_type, exception, traceback, debug_hook=sys.excepthook):
'''Print user friendly error messages normally, full traceback if DEBUG on.
Adapted from http://stackoverflow.com/questions/27674602/hide-traceback-unless-a-debug-flag-is-set
'''
if debug:
print '\n*** Error:'
# raise
@yash1th
yash1th / fibonacci_closure.go
Created February 19, 2020 14:06 — forked from tetsuok/fibonacci_closure.go
An answer of the exercise: Fibonacci closure on a tour of Go
package main
import "fmt"
// Very naive answer.
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
n := 0
a := 0
@yash1th
yash1th / Jenkinsfile.groovy
Created October 29, 2019 17:37 — forked from Faheetah/Jenkinsfile.groovy
Jenkinsfile idiosynchrasies with escaping and quotes
node {
echo 'Results included as an inline comment exactly how they are returned as of Jenkins 2.121, with $BUILD_NUMBER = 1'
echo 'No quotes, pipeline command in single quotes'
sh 'echo $BUILD_NUMBER' // 1
echo 'Double quotes are silently dropped'
sh 'echo "$BUILD_NUMBER"' // 1
echo 'Even escaped with a single backslash they are dropped'
sh 'echo \"$BUILD_NUMBER\"' // 1
echo 'Using two backslashes, the quotes are preserved'
sh 'echo \\"$BUILD_NUMBER\\"' // "1"
@yash1th
yash1th / qualityGates.groovy
Created October 29, 2019 15:56 — forked from rmpestano/qualityGates.groovy
Jenkins Sonar quality gates integration via shared library
#!/usr/bin/env groovy
/**
* Fails the pipeline if project quality doesn't meet the configured quality profile (see https://docs.sonarqube.org/display/SONAR/Quality+Gates AND https://docs.sonarqube.org/display/SONAR/Quality+Profiles).
* This DSL function must be invoked after the quality analisys has been published. Example:
*
* stage('sonar') {
* steps {
* withSonarQubeEnv('sonar') { //there must be a tool named 'sonar' configured on Jenkins (/jenkins/configureTools)
* sh 'mvn sonar:sonar' //publish project quality on sonar
@yash1th
yash1th / vpn.md
Created October 25, 2019 14:01 — forked from joepie91/vpn.md
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

A Russian translation of this article can be found here, contributed by Timur Demin. There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.

Why not?

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

@yash1th
yash1th / Jenkinsfile
Created September 16, 2019 21:05 — forked from HarshadRanganathan/Jenkinsfile
Jenkins Declarative Pipeline Example - https://rharshad.com/jenkins-pipeline-as-code/
def getProjectName() {
return 'JenkinsPipeline'
}
def getJDKVersion() {
return 'jdk1.8.0_101'
}
def getMavenConfig() {
return 'maven-config'