Skip to content

Instantly share code, notes, and snippets.

waleed samy waleedsamy

Block or report user

Report or block waleedsamy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@waleedsamy
waleedsamy / jmx-in-docker.md
Created Jul 26, 2018
Run java/jmx in docker container and use visaulvm to mointor your app
View jmx-in-docker.md

I was testing an application (parser.jar) and need to limit the resource used by the app (cpu/ram) and see how different implmenation behaves.

docker run --rm -p 9010:9010 -it --memory=3000MB --cpus="2" java:8-jdk bash -c " java \
      -server \
      -XX:+UseG1GC \
      -XX:+UseStringDeduplication \
      -XX:+ExitOnOutOfMemoryError \
      -Xmx2g \
@waleedsamy
waleedsamy / awk-add-nums.sh
Last active Jul 16, 2018
Use AWK to add numbers from two files
View awk-add-nums.sh
awk 'FNR==NR{a[NR]=$1;next}{ print $0 " + " a[FNR] " = " $0+a[FNR]}' total-time-317.log total-time-330.log
@waleedsamy
waleedsamy / Jenkinsfile
Created Oct 17, 2017
Jenkinsfile that extract git info, build multi-stage docker image, push to nexus and deploy to kubernetes
View Jenkinsfile
node {
def rock
def branch
def commit
def nexussrv = "nexus.example.de"
def nexussrv_office = "${nexussrv}:8843"
def nexussrv_datacenter = "${nexussrv}:9843"
@waleedsamy
waleedsamy / Dockerfile
Created Oct 13, 2017
Run docker inside Jenkins container
View Dockerfile
From jenkins
USER root
RUN apt-get update && apt-get install -y vim nano zsh curl git sudo
@waleedsamy
waleedsamy / artist.sh
Created Oct 2, 2017
update my mp3's to have only the artist information
View artist.sh
l=Bob\ Marley
d=/songs/$l
find "$d" -type f -iname "*.mp3" -exec ls '{}' +
find "$d" -type f -iname "*.mp3" -exec mid3v2 -D '{}' +
find "$d" -type f -iname "*.mp3" -exec mid3v2 --delete-frames=TALB,TCON,TPE1,TDRC,TIT2,AENC,ASPI,COMM,COMR,ENCR,EQU2,ETCO,GEOB,GRID,LINK,MCDI,MLLT,OWNE,PRIV,PCNT,POPM,POSS,RBUF,RVA2,RVRB,SEEK,SIGN,SYLT,SYTC,TBPM,TCOM,TCOP,TDEN,TDLY,TDOR,TDRL,TDTG,TENC,TEXT,TFLT,TIPL,TIT3,TKEY,TLAN,TLEN,TMCL,TMED,TMOO,TOAL,TOFN,TOLY,TOPE,TOWN,TPE3,TPE4,TPOS,TPRO,TPUB,TRSN,TRSO,TSOA,TSOP,TSOT,TSRC,TSSE,TSST,TXXX,UFID,USER,USLT,WCOM,WCOP,WOAF,WOAR,WOAS,WORS,WPAY,WPUB,WXXX '{}' +
find "$d" -type f -iname "*.mp3" -exec mid3v2 -l '{}' +
find "$d" -type f -iname "*.mp3" -exec id3tag --artist="$l" '{}' +
@waleedsamy
waleedsamy / bindasync.js
Created Aug 8, 2017
why bind async.js? because I can.
View bindasync.js
const async = require('async');
let ob = {
'x': 8,
'y': 16
}
function ci(callback) {
console.log('ci', this.x, this.y);
callback(null, 'berlin')
@waleedsamy
waleedsamy / git worktree
Created Aug 3, 2017
Run test for your project and continue working on the code in same time
View git worktree
git worktree add -b run-test-for-fix-bug-x ../fix-bug-x origin/fix-bug-x
rm -rf ../fix-bug-x && git worktree prune
@waleedsamy
waleedsamy / Function.scala
Created Aug 1, 2017
Function and PartialFunction Scala classes
View Function.scala
// func1 and func2 are synonyms
val func1 = (x: String) => "hello %s".format(x)
func1("world")
func1.apply("world")
val func2 = new Function1[String, String] {
def apply(x: String) = "hello %s".format(x)
}
func2("world")
func2.apply("world")
@waleedsamy
waleedsamy / rollout.sh
Created Jul 25, 2017
kubernetes rollout command in nutshell
View rollout.sh
#record revision with clear information
kubectl create -f xDeployment.yaml --record
# interactive command to get the status for a deployment, you can check it's result with $?
kubectl rollout status deploy/x
# show revisions
kubectl rollout history deploy/x
# details about revision 1
kubectl rollout history deploy/x --revision 1
#rollback to to previous version
kubectl rollout undo deploy/x
@waleedsamy
waleedsamy / grepchars
Created Jul 13, 2017
grep with 1 character before string and 6 character after
View grepchars
grep -E -o ".{0,1}string.{0,6}" afile
You can’t perform that action at this time.