Skip to content

Instantly share code, notes, and snippets.

View MrAmbiG's full-sized avatar
💭
Roar

Gajendra D Ambi MrAmbiG

💭
Roar
View GitHub Profile
@MrAmbiG
MrAmbiG / gitMigrate
Last active July 26, 2020 16:50
mirror repos
# clone the repo from your existing git source [gilab, github etc]
git clone OLDREPO
# cd into the cloned repo
cd NEWCLONEDREPO
# check in and check out of all clones branches to mirror them locally
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
# fetch and pull
@bradtraversy
bradtraversy / django_deploy.md
Last active September 26, 2024 19:02
Django Deployment - Digital Ocean

Django Deployment to Ubuntu 18.04

In this guide I will go through all the steps to create a VPS, secure it and deploy a Django application. This is a summarized document from this digital ocean doc

Any commands with "$" at the beginning run on your local machine and any "#" run when logged into the server

Create A Digital Ocean Droplet

Use this link and get $10 free. Just select the $5 plan unless this a production app.

# -*- mode: ruby -*-
# vi: set ft=ruby :
servers = [
{
:name => "k8s-head",
:type => "master",
:box => "ubuntu/xenial64",
:box_version => "20180831.0.0",
:eth1 => "192.168.205.10",
@mgiaccone
mgiaccone / vault-init.py
Created January 28, 2017 13:46
Hashicorp Vault auto initialize/unseal script - DO NOT USE IN PRODUCTION!!!
#!/usr/bin/env python
import json
import os
import requests
homeDir = os.path.expanduser("~")
configFile = os.path.join(homeDir, ".vault-config.json")
vaultAddr = os.environ['VAULT_ADDR']
@CESARDELATORRE
CESARDELATORRE / git.migrate
Created October 10, 2016 19:52
Move your existing git repository # to a new remote repository
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
### OPTION 1 ###########################################################################################
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
@Faheetah
Faheetah / Jenkinsfile.groovy
Last active October 26, 2024 16:38
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"
@christopherlovell
christopherlovell / display.py
Last active November 18, 2023 22:22
display youtube video in jupyter notebook
from IPython.display import HTML
# Youtube
HTML('<iframe width="560" height="315" src="https://www.youtube.com/embed/S_f2qV2_U00?rel=0&amp;controls=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>')
# Vimeo
HTML('<iframe src="https://player.vimeo.com/video/26763844?title=0&byline=0&portrait=0" width="700" height="394" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe><p><a href="https://vimeo.com/26763844">BAXTER DURY - CLAIRE (Dir Cut)</a> from <a href="https://vimeo.com/dannysangra">Danny Sangra</a> on <a href="https://vimeo.com">Vimeo</a>.</p>')
@mitchwongho
mitchwongho / Docker
Last active September 23, 2024 12:09
Docker 'run' command to start an interactive BaSH session
# Assuming an Ubuntu Docker image
$ docker run -it <image> /bin/bash
@niksumeiko
niksumeiko / git.migrate
Last active November 10, 2024 18:26
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
@didip
didip / supervisord-example.conf
Created January 30, 2011 05:10
Example configuration file for supervisord.conf
[unix_http_server]
file=/tmp/supervisor.sock ; path to your socket file
[supervisord]
logfile=/var/log/supervisord/supervisord.log ; supervisord log file
logfile_maxbytes=50MB ; maximum size of logfile before rotation
logfile_backups=10 ; number of backed up logfiles
loglevel=error ; info, debug, warn, trace
pidfile=/var/run/supervisord.pid ; pidfile location
nodaemon=false ; run supervisord as a daemon