Skip to content

Instantly share code, notes, and snippets.

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

Kareem H neumachen

🏠
Working from home
  • Bergen, Norway
  • 14:10 (UTC -12:00)
View GitHub Profile
@neumachen
neumachen / script
Created January 19, 2018 16:41
A command to skip the first line when using AWK
brew services list | awk '{if(NR > 1) print $1}' | xargs brew services stop
@neumachen
neumachen / semver.sh
Created January 20, 2018 13:54 — forked from lxhunter/semver.sh
Automated semantic versioning for travis-ci or any other ci
#!/bin/bash
export SEMVER_LAST_TAG=$(git describe --abbrev=0 --tags 2>/dev/null)
export SEMVER_RELEASE_LEVEL=$(git log --oneline -1 --pretty=%B | cat | tr -d '\n' | cut -d "[" -f2 | cut -d "]" -f1)
#curl -o /tmp/hub.tgz https://github.com/github/hub/releases/download/v2.2.9/hub-linux-arm64-2.2.9.tgz
#tar -xvzf /tmp/hub.tgz -C /tmp
if [ -z $SEMVER_LAST_TAG ]; then
>&2 echo "No tags defined"
func Milk(cow interface{Mooing; Grazing})
wget -qO- https://api.github.com/orgs/ORG/repos | jq ".[].ssh_url" | xargs -L 1 git clone
@neumachen
neumachen / go
Created January 29, 2018 01:35
A sample code to show how to check if a directory is empty extending magicalbanana/env custom parser funcs
package config
import (
"fmt"
"io"
"net/url"
"os"
"path/filepath"
"reflect"
)
psql -lqt | cut -d \| -f 1 | grep -qw <db_name>
@neumachen
neumachen / compress.go
Created February 11, 2018 01:56 — forked from bussiere/compress.go
compress uncompress a string in golang
package main
import (
"bytes"
"compress/gzip"
"fmt"
"encoding/base64"
"io/ioutil"
)
kubectl create clusterrolebinding add-on-cluster-admin --clusterrole=cluster-admin --serviceaccount=kube-system:default
# another fix
kubectl create clusterrolebinding --user system:serviceaccount:kube-system:default kube-system-cluster-admin --clusterrole cluster-admin
https://github.com/kubernetes/dashboard/issues/2326#issuecomment-326651713
# for fixing helm
kubectl create serviceaccount --namespace kube-system tiller
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
@neumachen
neumachen / assets.rake
Created October 27, 2018 23:41 — forked from guilleiguaran/assets.rake
Fixed rake assets:precompile task
desc "Compile all the assets named in config.assets.precompile"
task :precompile do
# We need to do this dance because RAILS_GROUPS is used
# too early in the boot process and changing here is already too late.
if ENV["RAILS_GROUPS"].to_s.empty? || ENV["RAILS_ENV"].to_s.empty?
ENV["RAILS_GROUPS"] ||= "assets"
ENV["RAILS_ENV"] ||= "production"
Kernel.exec $0, *ARGV
else
Rake::Task["environment"].invoke
@neumachen
neumachen / query.sql
Created October 29, 2018 15:50 — forked from ramiroaznar/query.sql
How to find duplicate values with PostgreSQL
select * from table t1
where (select count(*) from table t2
where t1.field = t2.field) > 1
order by field