Skip to content

Instantly share code, notes, and snippets.

View Dmitry-Kucher's full-sized avatar
🎯
Focusing

Dmitry Dmitry-Kucher

🎯
Focusing
View GitHub Profile
@Dmitry-Kucher
Dmitry-Kucher / README.md
Last active February 23, 2020 19:08
Kill program after timeout reached

To use timeout killer functionality use the following instructions:

  • Download timeout-killer.sh
  • Replace PROGRAM_REGEXP and TIMEOUT to your own values
  • Add executable rights chmod +x timeout-killer.sh
  • Run timeout killer ./timeout-killer.sh
@Dmitry-Kucher
Dmitry-Kucher / README.md
Created February 23, 2020 12:59
Count all occurrences of pattern in file

grep -o "string_pattern" filename[.file_extendsion] | wc -l

@Dmitry-Kucher
Dmitry-Kucher / mongodb_auth_string.sh
Last active January 24, 2020 13:06
Mongodb auth string generation via bash based on env variables
#!/bin/bash
MONGODB_SERVER=${MONGODB_SERVER:-127.0.0.1}
MONOGDB_PORT=${MONGODB_PORT:-27017}
MONGODB_USER=${MONGODB_USER:-""}
MONGODB_PWD=${MONGODB_PWD:-""}
MONGODB_AUTH=$([ $MONGODB_USER ] && printf "%s" "$MONGODB_USER" && [ $MONGODB_PWD ] && printf "%s" ":$MONGODB_PWD")
MONGODB_URI="mongodb://${MONGODB_AUTH}@${MONGODB_SERVER}"
echo ${MONGODB_URI}
@Dmitry-Kucher
Dmitry-Kucher / Nginx Log Analyzer
Last active February 4, 2020 09:59
AWK analyze nginx access.log to see how many requests made for specific path grouped by referer
awk '($7 ~ /\/my\/awesome\/path/)' access.log | awk '{print $11}' | sort | uniq -c | sort -rn
xcrun cc -arch x86_64 -Ddarwin64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -O3 -fPIC -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -Wno-unused-function dirToString.c -o /Users/dima/OpenFOAM/OpenFOAM-4.1/wmake/platforms/darwin64Clang/dirToString
flex wmkdep.l
xcrun cc -arch x86_64 -Ddarwin64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -O3 -fPIC -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -Wno-unused-function lex.yy.c -o /Users/dima/OpenFOAM/OpenFOAM-4.1/wmake/platforms/darwin64Clang/wmkdep
+ wmakePrintBuild -check
no git description found
+ wrmo OpenFOAM/global/global.o
removing .o files corresponding to OpenFOAM/global/global.o ...
+ wmakeLnInclude OpenFOAM
wmakeLnInclude: linking include files to OpenFOAM/lnInclude
+ wmakeLnInclude OSspecific/POSIX
CC dirToString.c
LEX wmkdep.l
CC lex.yy.c
+ wmakePrintBuild -check
no git description found
+ wrmo OpenFOAM/global/global.o
removing .o files corresponding to OpenFOAM/global/global.o ...
+ wmakeLnInclude OpenFOAM
LN OpenFOAM/lnInclude
+ wmakeLnInclude OSspecific/POSIX