Skip to content

Instantly share code, notes, and snippets.

View ierceg's full-sized avatar

Ivan Erceg ierceg

View GitHub Profile
@ierceg
ierceg / git-merge-master.sh
Last active January 17, 2024 18:39
Checkout master, pull, checkout previous current branch, merge master into it.
#!/bin/bash
# Save the current branch name
current_branch=$(git rev-parse --abbrev-ref HEAD)
if [ $? -ne 0 ]; then
echo "Error: Failed to get the current branch name."
exit 1
fi
# Set target branch to 'master' or the provided argument
@ierceg
ierceg / split-branch.sh
Last active December 29, 2023 20:46
Split branch into multiple PRs based on selected files, not commits
#!/bin/sh
# TODO:
# - Allow for splitting the same file into multiple branches.
# - If there are manual commits apart from the automatic merges and (split-branch) commits, <do something>. `git merge-base` is useful here.
# Design:
# - The script should be run from the branch that is being split.
# - The script accepts the target branch as an argument.
# - The script will automatically merge the target branch into the source branch if needed.
@ierceg
ierceg / github_gitlab_gpg_key.md
Last active August 14, 2022 10:26 — forked from ankurk91/github_gpg_key.md
Signing git commits using GPG (Ubuntu/Mac)

Github/GitLab : Signing commits using GPG (Ubuntu/Mac) 🔐

  • Do you have an Github/GitLab account ? If not create one.
  • Install required tools
  • Latest Git Client
  • gpg tools
# Ubuntu
sudo apt-get install gpa seahorse
# MacOS with https://brew.sh/
### Keybase proof
I hereby claim:
* I am ierceg on github.
* I am ierceg (https://keybase.io/ierceg) on keybase.
* I have a public key ASD9oiteKy0QvDlEto0XrP6hFcFcTDnu8CZLKFnYPsqxvQo
To claim this, I am signing this object:
@ierceg
ierceg / jenkins_ec2_slave.md
Created December 15, 2017 00:22 — forked from tfoote/jenkins_ec2_slave.md
Installing jenkins on an EC2 Windows slave
  • Create a Windows instance
  • Use the aws console to get username and password
  • log in via rdp
  • Turn off IE Enhanced security control
  • Open server settings, local server, turn it off
  • install chrome
  • Install java: https://www.java.com/en/download/
  • Create C:\Jenkins
  • go to jenkins instance
  • log in as admin
@ierceg
ierceg / export_envvars.sh
Created July 11, 2016 03:53
Export envvars from docker-like envvar file
#!/bin/bash
# As seen here https://stackoverflow.com/questions/2683279/how-to-detect-if-a-script-is-being-sourced
if [[ $0 == $BASH_SOURCE ]]; then
echo 'You must run this script as `source export_envvars.sh` for it to export the envvars.'
else
if [[ -z $1 ]]; then
echo 'You must provide name of the envvars file.'
else
# As seen here http://stackoverflow.com/questions/10929453/read-a-file-line-by-line-assigning-the-value-to-a-variable
@ierceg
ierceg / dump.js
Last active March 25, 2016 05:23
Dump installed, referenced and dev referenced npm packages
// Run this script from a directory above the packages you are analyzing
/* global process */
'use strict';
var _ = require('lodash');
var glob = require('glob');
var path = require('path');
@ierceg
ierceg / supergit
Created September 23, 2015 17:41 — forked from spiderr/supergit
#!/bin/bash
# Shell Script for super-respositores that executes git on all sub-repositories
# Homepage at http://www.bitweaver.org/wiki/supergit
# Licensed under the GPL
# Authors: github.com/spiderr
function usage {
appName=`basename $0`
echo "Welcome to $appName. It acts on all directories in your project as if they were sub-respositories. For most commands, you simply type what you would normally for git, however you simply type $appName with desired parameters in the super-repository root of your project. For example:"
echo "-- To clone, type '$appName git@github.com:bitweaver/bitweaver.git -b DEV testbw' which will clone, then intiliaze + update submodules and checkout the master branch for each submodule"

Keybase proof

I hereby claim:

  • I am ierceg on github.
  • I am ierceg (https://keybase.io/ierceg) on keybase.
  • I have a public key whose fingerprint is C9B1 7A0F 4DAB F632 DE37 FC67 D13E 8FC6 ACE6 74FC

To claim this, I am signing this object:

@ierceg
ierceg / cleanDb.js
Last active August 29, 2015 14:09
Clean-up non-design-docs from a CouchDb at the beginning of each test
var db = require('nano');
var debug = require('debug')('cleanDb');
var async = require('async');
function cleanDb(callback) {
debug('Cleaning up db from all non-design documents');
db.list(function(err, body) {
if(err) {