Skip to content

Instantly share code, notes, and snippets.

View normoes's full-sized avatar
💭
working

Norman Schenck normoes

💭
working
View GitHub Profile
@normoes
normoes / java_springboot_mongodb_aggregates.md
Last active April 12, 2023 16:04
mongodb aggregates using MongoRepository in Java spring boot

mongodb aggregates using MongoRepository in Java spring boot


Some prerequisites and assumptions

Use the following dependencies within your pom.xml:

  • spring-boot-starter-parent 1.5.7.RELEASE
  • spring-boot-starter-data-mongodb
@normoes
normoes / password creation.md
Last active July 13, 2021 18:40
passwords and encrypted passwords

password creation

cli password generation

apg -a 1 -m 15 -n 15

Output

HrTvb(r&xb1~}Xr
`i;af,/z%bi8(`x

hidden files

create an archive using tar (including hidden files)

taken from Digitesters

Normally:

tar czf backup.tar.gz /backup/*

This way all files are tarred except the hidden files.

@normoes
normoes / binary_math.md
Last active March 14, 2018 09:07
remember me: binary math

binary math

source

2's complement

101 -> 010 + 1 = 011
11010 -> 00101 + 1 = 00110

binary subtraction

@normoes
normoes / bit shifts.md
Last active March 14, 2018 08:44
remember me: shifting bits

shifting bits

n << 1 == n * 2
n << 2 == n * 4
n << 3 == n * 8
n &gt;&gt; 1 == n / 2
@normoes
normoes / python_byte_and_str.md
Last active October 15, 2018 09:23
byte and string in python
>>> a = 'world'    
>>> b = b'hello '    
>>> type(a)
<class 'str'>
>>> type(b)
<class 'bytes'>    

What's new in python3 shows:

>>> str.encode(a)

@normoes
normoes / docker_interactive_terminal.md
Last active September 4, 2018 09:33
interactive terminal in docker and docker-compose

docker cli

  -it

docker-compose

  stdin_open: true
  tty: true
@normoes
normoes / permissions_from_root.md
Created August 23, 2018 12:55
get folder permissions starting from root directory
  $ namei -om ~/tmp/newnew/
  f: /home/user/tmp/newnew/
  drwxr-xr-x root   root   /
  drwxr-xr-x root   root   home
  drwxr-xr-x user user user
  drwxrwxr-x user user tmp
  drwxrwxr-x user user newnew
@normoes
normoes / git_ssh_agent_ssh_add.md
Last active August 28, 2018 06:20
add ssh key on the fly when pulling form git

ssh-agent bash -c ' ssh-add ~/git_key/id_rsa; cd ~/some_git_repo; git pull'

@normoes
normoes / stdout_stderr.md
Last active October 12, 2018 07:46
redirection of stdout and stderr

source

Redirect stdout to one file and stderr to another file:

command > out 2>error

Redirect stderr to stdout (&1), and then redirect stdout to a file:

command &gt;out 2&gt;&amp;1