Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Vikas Kumar vikas027

🏠
Working from home
  • Sydney, Australia
View GitHub Profile
@ozbillwang
ozbillwang / packer-on-gcp.md
Last active Apr 22, 2020
google cloud - account.json file for packer
View packer-on-gcp.md

The problem

The document quality of Google Cloud is far away if compare with AWS. Here is a sample.

If you met below error, when running packer or other SDK,

$ cat packer.json
{
  "builders": [
@superseb
superseb / rancher2customnodecmd.sh
Last active Jun 22, 2021
Add custom node to Rancher 2.0 (from v2.0.0-alpha26 and up)
View rancher2customnodecmd.sh
#!/bin/bash
docker run -d -p 80:80 -p 443:443 --name rancher-server rancher/rancher:latest
while ! curl -k https://localhost/ping; do sleep 3; done
# Login
LOGINRESPONSE=`curl -s 'https://127.0.0.1/v3-public/localProviders/local?action=login' -H 'content-type: application/json' --data-binary '{"username":"admin","password":"admin"}' --insecure`
LOGINTOKEN=`echo $LOGINRESPONSE | jq -r .token`
# Change password
@miry
miry / rbac_role_cluster.yaml
Created Mar 4, 2018
Example of roles in K8S with RBAC
View rbac_role_cluster.yaml
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: staging-node-user
rules:
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
@vitalyisaev2
vitalyisaev2 / personal_access_token.py
Last active Mar 16, 2021
Script for obtaining Gitlab API Personal Access Token
View personal_access_token.py
#!/usr/bin/python3
"""
Script that creates Personal Access Token for Gitlab API;
Tested with:
- Gitlab Community Edition 10.1.4
- Gitlab Enterprise Edition 12.6.2
- Gitlab Enterprise Edition 13.4.4
"""
import sys
import requests
View semantic-commit-messages.md

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@paultyng
paultyng / password.tf
Last active Nov 30, 2017
Terraform Random Password Module
View password.tf
variable "length" {
default = "20"
}
resource "random_id" "password" {
byte_length = "${var.length * 3 / 4}"
}
output "password" {
value = "${random_id.password.b64}"
View dev-setup.sh
#!/usr/bin/env sh
docker-machine rm -f rancher host1
docker-machine create rancher --driver virtualbox --virtualbox-cpu-count "-1" --virtualbox-disk-size "8000" --virtualbox-memory "512" --virtualbox-boot2docker-url=https://github.com/boot2docker/boot2docker/releases/download/v1.11.2/boot2docker.iso
docker-machine scp scripts/rancher-net.sh rancher:.
docker-machine ssh rancher sh rancher-net.sh
docker-machine regenerate-certs rancher -f
eval $(docker-machine env rancher)
docker-compose up -d
eval $(docker-machine env -u)
docker-machine create host1 --driver virtualbox --virtualbox-cpu-count "-1" --virtualbox-disk-size "54000" --virtualbox-memory "2048" --virtualbox-boot2docker-url=https://github.com/boot2docker/boot2docker/releases/download/v1.11.2/boot2docker.iso
@cyrille-leclerc
cyrille-leclerc / pipeline.groovy
Last active Apr 8, 2021
Escape character & quotes in Jenkins Pipeline
View pipeline.groovy
docker.image('cloudbees/java-build-tools:0.0.6').inside {
sshagent(['github-ssh-credentials']) {
sh """
git version
git config --local user.email \\"cleclerc@cloudbees.com\\"
git config --local user.name \\"Cyrille Le Clerc\\"
git clone git@github.com:cyrille-leclerc/a-test-repo.git
date &> now.txt
@hayderimran7
hayderimran7 / get-api-token-of-user-jenkins-groovy.md
Last active Jun 7, 2021
jenkins groovy get API token of a user
View get-api-token-of-user-jenkins-groovy.md

This is pretty simple snippet to get API Token of a user , lets say "MYUser" in jenkins.
its pretty useful when you are working with 'jenkins-job-builder' to update jobs in jenkins, and you need to get the api token which JJB needs inorder to update jobs to ..
run this code in either jenkins script console , or as i prefer, in form of init.groovy.
so when jenkins master starts, i create a user for JJb.
after that i get the token right away and pass it to my JJB jobs folder to file 'jenkins_jobs.ini' :)_ .

///////////////////////////////////////////////////////////////////////
@phrawzty
phrawzty / 2serv.py
Last active Jun 23, 2021
simple python http server to dump request headers
View 2serv.py
#!/usr/bin/env python2
import SimpleHTTPServer
import SocketServer
import logging
PORT = 8000
class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):