Skip to content

Instantly share code, notes, and snippets.

View ravibhure's full-sized avatar

Ravi ravibhure

View GitHub Profile
@ravibhure
ravibhure / git_rebase.md
Last active April 11, 2025 09:30
Git rebase from remote fork repo

In your local clone of your forked repository, you can add the original GitHub repository as a "remote". ("Remotes" are like nicknames for the URLs of repositories - origin is one, for example.) Then you can fetch all the branches from that upstream repository, and rebase your work to continue working on the upstream version. In terms of commands that might look like:

Add the remote, call it "upstream":

git remote add upstream https://github.com/whoever/whatever.git

Fetch all the branches of that remote into remote-tracking branches, such as upstream/master:

git fetch upstream

@ravibhure
ravibhure / redis_and_resque.mkd
Created November 25, 2016 08:21 — forked from Diasporism/redis_and_resque.mkd
How to configure Redis and Resque for your Rails app.

Redis and Resque

What this guide will cover: the code you will need in order to include Redis and Resque in your Rails app, and the process of creating a background job with Resque.

What this guide will not cover: installing Ruby, Rails, or Redis.

Note: As of this writing I am still using Ruby 1.9.3p374, Rails 3.2.13, Redis 2.6.11, and Resque 1.24.1. I use SQLite in development and Postgres in production.

Background jobs are frustrating if you've never dealt with them before. Over the past few weeks I've had to incorporate Redis and Resque into my projects in various ways and every bit of progress I made was very painful. There are many 'gotchas' when it comes to background workers, and documentation tends to be outdated or scattered at best.

@ravibhure
ravibhure / headless.md
Created December 29, 2016 13:01 — forked from addyosmani/headless.md
So, you want to run Chrome headless.
@ravibhure
ravibhure / Query-Registry.ps1
Created January 24, 2017 04:00 — forked from so0k/Query-Registry.ps1
Query a docker registry v2/_catalog endpoint from powershell
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True,Position=1)]
$Filter=".*",
#TODO: handle https & no basic auth as well..
$RegistryEndpoint = "registry.mysite.com",
$UserName = "user",
$Password = "password"
)
@ravibhure
ravibhure / install_docker.sh
Created February 6, 2017 05:27
Install Docker
#!/bin/bash
# install docker on ubuntu
# https://docs.docker.com/engine/installation/linux/ubuntu/
myname=`id -u -n`
sudo apt-get update
sudo apt-get -y install curl \
linux-image-extra-$(uname -r) \
linux-image-extra-virtual
@ravibhure
ravibhure / UbuntuLXCPortForwarding.md
Created February 14, 2017 12:25
Ubuntu LXC Port Forwarding

Ubuntu LXC Port Forwarding

So you have a service running in an LXC container behind a bridge, and you need ports forwarded for that service. In this case, we'll use Minecraft as an example, which runs on port 25565. Our container's IP is 10.0.3.116.

sudo iptables -t nat -I PREROUTING -p tcp -d $PUBLICIP --dport 25565 -j DNAT --to 10.0.3.116:25565
sudo iptables -A FORWARD -p tcp -d 10.0.3.116 --dport 25565 -j ACCEPT
@ravibhure
ravibhure / delete_unattached_volumes.py
Created February 15, 2017 08:46
Delete unattached volume
#!/usr/bin/env python
from boto import ec2
conn = ec2.connect_to_region('us-west-2')
#vols = conn.get_all_volumes(filters={'status': 'available'})
vols = conn.get_all_volumes(filters={'status': 'available', 'tag-key' : 'Name', 'tag-value' : 'kubernetes*'})
for vol in vols:
#print 'checking vol:', vol.id, 'status:', vol.status
@ravibhure
ravibhure / Kubernetes_debug.md
Created March 15, 2017 09:15
Kubernetes – troubleshooting and commands

*How to reset kubernetes configuration and setup *Change service IP subnet *Useful commands *Logs

0. How to reset kubernetes configuration and setup

When you start experimenting with kubernetes it is useful to reset all and start from scratch. During "reset" etcd and flanneld should be running and configured correctly because docker is in dependency.

@ravibhure
ravibhure / haproxy_auth.md
Created March 28, 2017 13:13
Configure HAProxy for userlists

Create SHA512 passwords

# make sure to use a leading space so that the command is not stored in your bash history!!
 mkpasswd -m sha-512 password1
# generates -> $6$yMgsow58.g/Z$mBjHfdVzqcF/LN.iwV23Eyqg.yGPTsp9pOwaStsJ6c4I4zL7BhucVVAkv5guf7OVRr8Pw0mHF4NrWBRCG5ci7/
 mkpasswd -m sha-512 password2
# generates -> $6$RZ86vRkQ$aRKN1HOsk6bDHBbMhS7jSo/p1NGFl4PvwY3KpU.72i./LvITi41nL84EkxOFXl.6Bmhynj/L7pYbfF0rUHtOB0
## How to install on Ubuntu (also works on Ubuntu for Windows)
https://github.com/magnumripper/JohnTheRipper
https://github.com/magnumripper/JohnTheRipper/blob/bleeding-jumbo/doc/EXAMPLES
https://dunnesec.com/category/tools/john-the-ripper/decrypting-linuxunix-password-shadow-files-using/
## From apt packages
### install
sudo apt-get update