Skip to content

Instantly share code, notes, and snippets.

View jgeek's full-sized avatar

MohammadReza Kargar jgeek

  • MCI
  • Tehran, Iran
View GitHub Profile
@jgeek
jgeek / lc1
Last active April 20, 2022 11:16
Linux commands
Generate ssl key:
openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr
find files recursively:
find . -name "*.bak" -type f -delete
But use it with precaution. Run first:
find . -name "*.bak" -type f
----------
@jgeek
jgeek / gc
Last active April 24, 2016 13:48
git commands
$ sudo apt-get install git
--------------
1. /etc/gitconfig file: Contains values for every user on the system and
all their repositories. If you pass the option --system to git config, it
reads and writes from this file specifically.
2. ~/.gitconfig or ~/.config/git/config file: Specific to your user.
You can make Git read and write to this file specifically by passing the --
global option.
3. config file in the Git directory (that is, .git/config) of whatever repos-
itory you’re currently using: Specific to that single repository.
@jgeek
jgeek / docker_commands.txt
Last active March 25, 2022 09:56
docker commands
https://github.com/wsargent/docker-cheat-sheet
# find PID if a container:
docker inspect --format '{{ .State.Pid }}' CONTAINER_ID
# Get the latest Docker package
$ wget -qO- https://get.docker.com/ | sh
# lists dockers images
$ sudo docker images
@jgeek
jgeek / java_commands.txt
Last active January 13, 2016 14:58
Java Commands
heap dump:
jmap -dump:format=b,file=heap.bin <pid>
thread dump:
jstack -l JAVA_PID > jstack.out
-----------------
# java links:
https://www.reucon.com/cdn/java/
http://ghaffarian.net/downloads/Java/JDK/
@jgeek
jgeek / maven_commands.txt
Last active September 27, 2015 07:49
maven commands
#define profile and build upon it:
<modules>
<module>module1</module>
<module>module2</module>
...
</modules>
...
<profiles>
<profile>
<id>ci</id>
@jgeek
jgeek / bash.txt
Last active March 17, 2022 19:13
bash script
# loops:
#!/bin/bash
for i in 1 2 3 4 5
do
echo "Welcome $i times"
done
#!/bin/bash
for i in {1..5}
do
@jgeek
jgeek / logstash.txt
Last active October 26, 2015 11:05
logstash commands
# verify config file
$ logstash -f first-pipeline.conf --configtest
# run logstash with config file
$ logstash -f first-pipeline.conf
# pipleline example:
$ for (( ; ; )) do nc localhost 3333 < tomcat_logs/localhost_access_log.2015-08-20.txt ;
sleep 1;done
@jgeek
jgeek / spring.txt
Last active February 29, 2016 14:29
spring
http://www.baeldung.com/spring-boot-application-configuration
http://jmelo.lyncode.com/spring-boot-maven-plugin-without-referencing-parent/
http://www.leveluplunch.com/blog/2014/04/16/spring-boot-swagger-springmvc-configuration/
@jgeek
jgeek / oracle_commands.txt
Created April 3, 2016 10:56
oracle commands
sqlplus / as sysdba
@jgeek
jgeek / play
Last active April 9, 2016 12:56
Play framework
http://stackoverflow.com/questions/27848548/play-framework-2-3-x-bytechunks-mp3-streaming-has-no-playback-is-not-scrollabl
With(MP3Headers.class)
public static Result test() {
final int begin, end;
final boolean isRangeReq;
response().setHeader("Accept-Ranges", "bytes");
if (request().hasHeader("RANGE")) {
isRangeReq = true;
String[] range = request().getHeader("RANGE").split("=")[1].split("-");