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 statistics | |
| import ast | |
| import math | |
| import json | |
| from typing import Callable | |
| class ParseError(Exception): | |
| pass |
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
| #!/bin/sh | |
| diff --color <(yq -P 'sort_keys(..)' $1) <(yq -P 'sort_keys(..)' $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
| # Shoulid be in ~/.local/share/applications/idea-ultimate.desktop | |
| [Desktop Entry] | |
| Version=1.0 | |
| Name=Idea Ultimate | |
| GenericName=IDE | |
| Terminal=false | |
| Exec=/opt/idea-IU-212.5457.46/bin/idea.sh | |
| Terminal=false | |
| Type=Application | |
| Icon=/opt/idea-IU-212.5457.46/bin/idea.svg |
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
| #!/bin/bash | |
| # Fix for working in IntelliJ behind corporate firewall in Linux. | |
| # Note that this makes your Idea's TLS communications monitored. | |
| # Note that if you have a JetBrains license owned by your company, | |
| # then better ask your IT support to fix cert problems instead. | |
| # Howto: | |
| # 0. Your company cert is expected to be in /usr/local/share/ca-certificates/extra/MyCompanyCA.crt | |
| # 1. Launch Intellij. | |
| # 2. Copy CA storage path from the "certificate problem" pop up dialog. Close IntelliJ. |
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
| while inotifywait -e modify -r . ; | |
| do | |
| lein test; | |
| echo; | |
| 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
| #!/bin/bash | |
| docker inspect $1 | jq -r ".[0].NetworkSettings.Networks.${2:-bridge}.IPAddress" |
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 --name=a-test-mysql --detach \ | |
| -e MYSQL_USER='blaser' \ | |
| -e MYSQL_PASSWORD='ok' \ | |
| -e MYSQL_DATABASE='dratabasss' \ | |
| mysql/mysql-server:5.7 |
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
| # Some docs imly source can be a directory, but it does not work actually. | |
| # Below is a workaround | |
| for p in a-source-folder/* | |
| do | |
| # Note that uppercase JPG suffix is not recognized so adding "jpg" to output file name. | |
| darktable-cli --width 3000 --height 3000 --hq true $p $(dirname $p)-export/$(basename ${p%.JPG}.jpg); | |
| 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
| use std::net::TcpListener; | |
| use std::net::UdpSocket; | |
| use std::net::TcpStream; | |
| use std::net::Shutdown; | |
| use std::thread; | |
| use std::io::BufReader; | |
| use std::io::Write; | |
| use std::io::BufRead; | |
| fn session(mut ios: TcpStream) -> Result<(), std::io::Error> { |
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
| rom collections import defaultdict | |
| from math import inf | |
| def find_closest(dist, unvisited): | |
| # Select node with the least distance to source | |
| u = None | |
| min_du = inf | |
| for v in unvisited: | |
| if dist[v] < min_du: |