I'm a passionated and experienced developer from Munich, Germany.
- 🔭 I work with Kubernetes, Docker, Node.js, React.js, Next.js, Go and now also Rust
- In my current project I use Svelte.js, to learn new things.
This repository contains my personal HowCanI data
To verify which path will be used you can enter
xcode-select -p
To install the command line tools you can enter
xcode-select --install
To use the commandline tools instead of XCode you have to enter
sudo xcode-select -s /Library/Developer/CommandLineTools
Detaching from the container without stopping Ctrl-P Ctrl-Q
Just press q:
to show the command history or q/
to show the search history
See also wikia Using_command-line_history
tabstop
The width of a hard tabstop measured in "spaces" -- effectively the (maximum) width of an actual tab character.
shiftwidth
The size of an "indent". It's also measured in spaces, so if your code base indents with tab characters then you want shiftwidth to equal the number of tab characters times tabstop. This is also used by things like the =, > and < commands.
softtabstop
Setting this to a non-zero value other than tabstop will make the tab key (in insert mode) insert a combination of spaces (and possibly tabs) to simulate tab stops at this width.
expandtab
Enabling this will make the tab key (in insert mode) insert spaces instead of tab characters. This also affects the behavior of the retab command.
smarttab
Enabling this will make the tab key (in insert mode) insert spaces or tabs to go to the next indent of the next tabstop when the cursor is at the beginning of a line (ie: the only preceding characters are whitespace).
To configure this setting for a specific fileype you've to enter the following line in your .vimrc
autocmd expandtab BufNewFile,BufRead *.py setlocal tabstop=4 shiftwidth=4 softtabstop=4
or shorthand for vim modeline:
vim :set ts=4 sw=4 sts=4 et :
{
field: { $ne:null }
}
If you want to search for a field that not exists, you have to use the following query:
{
field: { $exists:false }
}
Just enter df -ah
To check the size of a specific directory you can enter du -sh {directoryname}
Disabling Apple’s new System Integrity Protection ‘csrutil’, also called “rootless”, introduced with Mac OS X 10.11 El Capitan is easily down by booting into recovery mode and executing the command ‘csrutil disable’ in terminal.
You just have to enter the following commandline
pytlint *.py -r n
It's in /etc/default/docker
(on systems which are using systemd it's in /lib/systemd/system/docker.service)
after you changed this file you've to restart the Docker daemon service with sudo service docker restart
The alpine image is a very small image, it has only a size of 5 MB. Unfortunately there's no bash inside available. But of course there is a shell. You can reach it with
docker run -i -t --name=alpine alpine /bin/sh
or just exec into a running image with
docker exec -it container_name /bin/sh
Just press Ctrl+W Ctrl+R
:'<,'>s/red/green/g
The replace text on the whole page instead of the selected text, you have to enter. The c at the end let vim asks you before each replacing.
:%s/red/green/gc
see also Search_and_replace_in_a_visual_selection
or Search_and_replace
docker pull caktux/travis-cli
docker tag caktux/travis-cli travis-cli
docker run --rm travis-cli encrypt -r howcani-project/howcani-project.github.io GH_TOKEN={YOUR_PERSONAL_GITHUB_ACCESS_TOKEN} | pbcopy
To undo the last commit you've to enter
git reset --hard HEAD~1
To undo a complete merge that contains more than one commit you've to find the id of your last commit before the merge and then enter
git reset --hard COMMIT_HASH
But attention, this way you can only do for commit you haven't pushed before. When you want to undo a commit you pushed to the origin you've to use revert
git revert -m 1 commit_hash
To set a bookmark that is valid for the current page press m and then a lowercase letter. You can use the same letter on different pages. But you have to have activated this page to navigate to the set bookmark.
To set a bookmark that is valid between all pages press a uppercase letter.
To navigate back to the bookmark press ' (jumps to the beginning of the line) or ` (jumps back to the exact position) and then the letter again.
The last commit message you can change with
git commit --amend
When you want to show more than one commit message, for example the latest 3 or one of this, you have to enter
git rebase -i HEAD~3
But you should only do this with commits that you've not pushed to any remote server!!!
You have to write it in the following syntax: chmod u=rwx,g=rx,o=r {filenname}
But the calculation of the numbers is really easy:
The first number is for the owner, the second number is for the group, and the third number is for all other users.
So to calculate the numbers for each you just have to add the rights (4+2+1=7) and then concatenate the number. So in case that you can do everything, the group members can only read and all other users have no access the number is 740.
http://www.onlineconversion.com/html_chmod_calculator.htm
More info: https://www.pluralsight.com/blog/it-ops/linux-file-permissions
git tag -d release01
git push origin :refs/tags/release01
To remove a docker image you have to enter the following command
docker rmi {id}
To delete all docker images enter
docker rmi $(docker images -a -q)
To delete all docker images that are not tagged enter
docker rmi -f $(docker images | grep "<none>" | awk "{print \$3}")
To delete all docker containers enter
docker rm $(docker ps -a -q)
The following code executes your tests automatically with nose
if __name__ == "__main__":
import nose
nose.run(argv=["", "test_server", "--verbosity=2"])
Open vim in the following way
vim +{linenumber} {filename}
with vim-fetch you can open a file also in this way
vim {filename}:{linenumber}:{columnumber}
Select the lines that should be edited
Press :
Vim will automatically enter the follwing text :'<,'>
Now enter the following text to replace red with green
:'<,'>s/red/green/g
See also vim wikia.com
Just enter in the console df -h
To find out more about the disk usage install sudo apt-get install ncdu
and then enter sudo ncdu
in the root directory
For this you can use netstat. You should use it as root (sudo) to see the process names.
sudo netstat -tulpn
Uninstall Oracle Java using the Terminal
Note: To uninstall Java, you must have Administrator privileges and execute the remove command either as root or by using the sudo.
Remove one directory and one file (a symlink), as follows:
sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefpane
This tip is from here
find /home/ -type f -size +512k -exec ls -lh {} \;
You can use the builtin crypto module for that.
const crypto = require('crypto');
function hashPassword(password, salt, algorithm='sha256'){
let hash = crypto.createHmac(algorithm, salt);
hash.update(password);
let value = hash.digest('hex');
return {
salt: salt,
passwordHash: value
};
}
See also this article
/usr/bin/nosetests --with-xunit --xunit-file=test_output.xml
There're some nice modules on npmjs.org available, but for the most you've to know the total number of items. When you don't know it, the module can't calculate the percentage value.
In such cases you could show a dot to just show that something was happened. But console.log
doesn't help you in this cases, since it always adds a new line break at the end.
Instead of that you could do what console.log is also doing, using the stdout stream, but without the newline at the end.
process.stdout.write('.');
For this you can use lsof. On MacOS you have to install it with brew before.
lsof {complete path and filename}
Shows you all informations you need to now. To find out which files are opened by a specific process you just have to enter lsof -p {processed}
.container{
display: flex;
/* Center according to the main axis */
justify-content: center;
/* Center according to the secondary axis */
align-items: center;
}
this.constructor.name
will return the name of the class even it's a derived class
sudo chown -R $(whoami):admin /usr/local
To build an executable for another platform than the current platform (Docker is running on a Linux OS) you've to set the GOOS environment variable. So you can build executable binaries for MacOS (darwin) and Windows platforms.
GOOS=darwin GOARCH=amd64 go build
GOOS=windows GOARCH=386 go build
GOOS=linux GOARCH=amd64 go build
To find out which platform you've to define for your current system, you can install the node module go-platform. This return the current os and cpu-architecture.
When the System is a new Linux distribution you can use systemctl (which comes from systemd), on older systems you've to use the service command.
with list you can list all running services, with status you can get the status, and with start and stop you can control it. see also
On MacOS you've to use launchctl see also
pylint --generate-rcfile > .pylintrc
To ignore a line just append the following comment:
console.log('Using Development Mode: ', process.env.NODE_ENV, isDevelopment); // eslint-disable-line no-console
To ignore a code block you have to enter two comments
/*eslint-disable */
Some code that should not be verified by eslint
/*eslint-enable */
You have to enter the following shebang in the first line
#!/usr/bin/python3
After that you've to make your script executable with chmod +x youmagicscript.py
Now you can enter your script in your terminal shell.
find -iname "query"
See also: How To Use Find and Locate to Search for Files on a Linux VPS or getting-started-with-find-utility
:!rm %
See also: Get the name of the current file
To get rid of unused containers and images you can execute the following commands:
# remove stopped + exited containers, I skip Exit 0 as I have old scripts using data containers.
docker rm -v $(docker ps -a | grep "Exit [1-255]" | awk '{ print $1 }')
# remove untagged images
docker rmi $(docker images | grep none | awk '{ print $3}')
# remove unused volumes
docker volume rm $(docker volume ls -q )
# `shotgun` remove unused networks
docker network rm $(docker network ls | grep "_default")
On MacOS the Docker client stores everything in virtual disk image file and this file can grow to an enormous size. Actually the file will now shrinked by the Docker client after deleting some Docker images. There're two ways to handle that. The first is to stop the Docker client and then delete the Docker.qcow2 file which is stored in ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux. But ATTENTION, you'll lose all you containers and images with that!
The second way is to try to shrink it manually by executing the following script, after stopping the Docker client
mv Docker.qcow2 Docker.qcow2_backup
qemu-img convert -O qcow2 Docker.qcow2_backup Docker.qcow2
See also Reclaim disk space from a sparse image file (qcow2/ vmdk)
With git reflog you can see all changes you made in the repository.
Now you can enter the commit you want to restore. After that you're in a detached state. So you've to create a new branch from this state with git branch restore-commit. This branch should now contain the missing files.
The answer is in this article. http://blog.jhades.org/functional-reactive-programming-for-angular-2-developers-rxjs-and-observables/
"When we create a subscriber, we are setting up a whole new separate processing chain"
When you've installed this version before you just have to enter the following command
brew switch {app name} {version}
Just enter the following in the command line:
:set ff=unix
sudo chown -R $(whoami) /usr/local
When you've installed the vim-surround plugin it's easy. You just to set the focus within the tag and then enter
In this case the complete element will be replaced, even the attributes.
When you only change for example from a span to a div, but leave the attributes.
You've to enter the same but without the > at the end
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.