Skip to content

Instantly share code, notes, and snippets.

View samiron's full-sized avatar
🏠
Working from home

Samiron paul samiron

🏠
Working from home
View GitHub Profile
#!/bin/bash
set -e
while true; do
log="$HOME/.npm/_logs/`ls $HOME/.npm/_logs/ | tail -n 1`"
echo "log: $log"
for path in `cat "$log" | grep 'ENOTEMPTY' | grep -oE "[^']+node_modules[^']+"`; do
echo "removing $path"
rm -rf "$path"
done
@samiron
samiron / .zshrc
Last active May 12, 2023 19:59
.zshrc files
source ~/.zshrc.java
source ~/.zshrc.git
@samiron
samiron / comments_controller.rb
Created September 19, 2012 07:26
Sample Rails Controller
class CommentsController < ApplicationController
# GET /comments
# GET /comments.json
def index
@comments = Comment.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @comments }
end
@samiron
samiron / release-items.sh
Last active August 24, 2022 12:42
find jira items since the last tag
#!/bin/sh
# Usage:
# ./release-items.sh last-release-tag jira_number_prefix [-v]
jira_prefix=$1
since_tag=$2
if [ -z "$3" ]; then
lines=$(git log --oneline --first-parent "$since_tag"..HEAD | cut -d ' ' -f 5- | sed -nE "s/.*((:?${jira_prefix})\-[0-9]{3,6}).*/\1/p")
@samiron
samiron / decorator.rb
Created May 9, 2010 06:40
A code example of decorator pattern in Ruby. The example is taken from Head First Design Pattern book.
module AbstractBeverage
def cost
raise Exception, %Q|You should implement the cost for #{self.class}|
end
end
class DarkRoast
include AbstractBeverage
COST = 0.99
def cost
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: my-app-batch
namespace: appns
spec:
volumes:
- name: all-configs
configMap:
name: my-app-batch-config
@samiron
samiron / AnotherClass.java
Last active July 22, 2020 15:59
Function Relaying Using Java 8
something else
@samiron
samiron / .bashrc.spaul
Last active November 15, 2017 07:14
Personal bashrc file contains general utility. Will grow over time.
alias gs="git status"
function gds(){
git diff --color=always --staged "$@" | less -rS
}
function gd(){
git diff --color=always "$@" | less -rS
}