Skip to content

Instantly share code, notes, and snippets.

View athreyapatel's full-sized avatar
🌍

Athreya Patel athreyapatel

🌍
View GitHub Profile
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@Dakuan
Dakuan / Simple Twitter Auth
Created July 1, 2013 11:01
Authenticate with the Twitter API using OAuth and Node.js
var OAuth2 = require('OAuth').OAuth2;
var https = require('https');
var oauth2 = new OAuth2(KEY, SECRET, 'https://api.twitter.com/', null, 'oauth2/token', null);
oauth2.getOAuthAccessToken('', {
'grant_type': 'client_credentials'
}, function (e, access_token) {
console.log(access_token); //string that we can use to authenticate request
var options = {
@paulallies
paulallies / gist:0052fab554b14bbfa3ef
Last active November 12, 2023 23:00
Remove node_modules from git repo
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin <branch-name>
@steinwaywhw
steinwaywhw / One Liner to Download the Latest Release from Github Repo.md
Last active June 7, 2024 09:39
One Liner to Download the Latest Release from Github Repo
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
@jeroenr
jeroenr / k8s-descriptor.yml
Last active December 1, 2020 06:20
Kamon, prometheus, grafana in Kubernetes
apiVersion: v1
kind: Namespace
metadata:
name: monitoring
labels:
name: monitoring
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
# Source: https://gist.github.com/d860631d0dd3158c32740e9260c7add0
minikube start --vm-driver=virtualbox
kubectl get nodes
git clone https://github.com/vfarcic/k8s-specs.git
cd k8s-specs
cd k8s-specs
git pull
minikube start --vm-driver=virtualbox
kubectl config current-context
kubectl create cm my-config \
--from-file=cm/prometheus-conf.yml
/**
* Takes a google maps api key and
* a json props object to generate
* a valid URL to a static map image.
* 
* @returns a valid URL to static map image
*/
function getStaticMap(key, props) {
 const markers = (props.markers || []).map(marker =&gt; 
@dwdraju
dwdraju / k8s-log-viewer-role.yml
Created October 19, 2018 16:02
Kubernetes RBAC for Log Viewer
kind: Role
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: user-log-reader
namespace: default
rules:
- apiGroups:
- ""
resources:
- pods
# Source: https://gist.github.com/c83d74ec70b68629b691bab52f5553a6
###############################
# Preparing For The Exercises #
###############################
git clone \
https://github.com/vfarcic/devops-catalog-code.git
cd devops-catalog-code