This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import kotlinx.coroutines.CoroutineScope | |
| import kotlinx.coroutines.Dispatchers | |
| import kotlinx.coroutines.delay | |
| import kotlinx.coroutines.launch | |
| fun main() { | |
| val jobs = List(5) { | |
| val job = CoroutineScope(Dispatchers.Default).launch { | |
| delay(2000) | |
| println("Work $it is done") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| tasks.register("before") { | |
| doLast { | |
| val myVar = "Hello variable" | |
| println(myVar) | |
| } | |
| } | |
| tasks.register("after") { | |
| doLast { | |
| println("Hello, 2!") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| docker run -it \ | |
| --user $(id -u):$(id -g) \ | |
| -v ~/Desktop:/tmp \ | |
| mysql:5.7.37 /bin/bash -c \ | |
| "mysqldump -h hostname -u username -p databasename table1 table2 --port 3306 > /tmp/dumpfile.sql" | |
| # https://stackoverflow.com/questions/44015692/access-denied-you-need-at-least-one-of-the-super-privileges-for-this-operat | |
| grep -n @@SESSION. myDB.sql | |
| sed -i '18d' myDB.sql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://stackoverflow.com/questions/3380805/checkout-old-commit-and-make-it-a-new-commit | |
| # https://gist.github.com/CrookedNumber/8964442?permalink_comment_id=3426850#gistcomment-3426850 | |
| git reset --hard 0fee5ad9 | |
| git push origin -f | |
| # https://stackoverflow.com/questions/7744049/git-how-to-rebase-to-a-specific-commit | |
| git rebase --onto <new parent commit hash> <old parent commit hash> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.File | |
| import java.lang.ProcessBuilder.Redirect.INHERIT | |
| import java.nio.file.Files | |
| import java.util.concurrent.TimeUnit.MINUTES | |
| import kotlin.io.path.Path | |
| const val ROOT = "/home/geoffrey/Desktop/gitlab" | |
| fun main() = Files | |
| .walk(Path(ROOT), 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.* | |
| import javax.crypto.Cipher.* | |
| import javax.crypto.spec.IvParameterSpec | |
| import javax.crypto.spec.SecretKeySpec | |
| fun main() { | |
| val str = "Hello World !" | |
| val encryptionKey = "1mfNnQ8CSdxHOhwO" | |
| println(str) | |
| val encoded = encrypt(str, encryptionKey) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export PYENV_ROOT="$HOME/.pyenv" | |
| export PATH="$PYENV_ROOT/bin:$PATH" | |
| eval "$(pyenv init --path)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: '3.7' | |
| services: | |
| postgis: | |
| image: postgis/postgis:12-3.1 | |
| restart: always | |
| environment: | |
| - POSTGRES_USER=demo | |
| - POSTGRES_PASSWORD=demo | |
| - POSTGRES_DB=demo | |
| ports: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Windows Registry Editor Version 5.00 | |
| [HKEY_CLASSES_ROOT\Applications\photoviewer.dll] | |
| [HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell] | |
| [HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open] | |
| "MuiVerb"="@photoviewer.dll,-3043" | |
| [HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\command] | |
| @=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\ | |
| 00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,72,00,75,00,\ | |
| 6e,00,64,00,6c,00,6c,00,33,00,32,00,2e,00,65,00,78,00,65,00,20,00,22,00,25,\ | |
| 00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,46,00,69,00,6c,00,65,00,73,00,\ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo chown -R $(id -u):$(id -g) ~/Desktop/ | |
| sudo chown -R $USER:$USER . | |
| sudo chmod a+rwx myFile.sh | |
| # 10 biggest files | |
| du -a -h /path | sort -h -r | head -n 10 | |
| ls -1Rhs | sed -e "s/^ *//" | grep "^[0-9]" | sort -hr | head -n20 | |
| # See which PID/service is using a certain IP and port: | |
| sudo netstat -nlpt |grep 3306 |
NewerOlder