Skip to content

Instantly share code, notes, and snippets.

View costa's full-sized avatar

Costa Shapiro costa

View GitHub Profile
$ DU_IGNORES=Volumes ~/local/script/du_sum.rb
du -I 'Volumes' /
Password:
1550280 du
.20T /Users
...
| 25.G /Users/Shared
| | | 24.G /Users/Shared/iTunes/Music
...
38.G /Applications
@costa
costa / PUB.md
Last active August 20, 2024 08:34
basic hierarchical file system analysis script

The most ancient problem of disk space -- and an also ancient problem of sharing scripts

Please disregard this public post if

  • you think that you have not had any disk space problems in recent years and that the author quite frankly might just be behind on personal computing technology since everything is done "off the cloud" these days, or --
  • you think the problem is too advanced for you to even try anything (like simply analysing your file system hierarchically, on your own) and you trust that "common" (commercial) solutions are your best options -- whenever it happens
@costa
costa / wicked_pdf.rb
Created October 1, 2021 19:20
Workaround setup for: https://github.com/mileszs/wicked_pdf/issues/860 (see my comment there)
# ./config/initializers/wicked_pdf.rb
WICKED_PDF_HELPER_SERVER_PORT = 28601 # NOTE no reason
WickedPdf.config = {
# Layout file to be used for all PDFs
# (but can be overridden in `render :pdf` calls)
# layout: 'pdf.html',
}.tap do |config|
rack_up = caller.map(&:to_s).grep(/rack.*server/i).any? # SEE https://stackoverflow.com/a/49598328/714287
if rack_up && Rails.configuration.asset_host.blank?
@costa
costa / nginx-conf.d-default.conf
Last active August 10, 2021 13:00
Sample (nginx) reverse proxy configuration for Docker Compose configuration for "staging" web interface access with OpenVPN
server {
listen 80;
listen [::]:80;
location / {
proxy_pass https://some.internal-web.app;
}
}
@costa
costa / docker-compose.yml
Created August 10, 2021 12:57
Sample Docker Compose configuration for "staging" web interface access with OpenVPN
version: '3.4'
services:
open-vpn:
image: dperson/openvpn-client
cap_add:
- net_admin
devices:
- /dev/net/tun
dns: 8.8.4.4 # NOTE not sure how to make this generic
command: -d -a "$OVPN_USER;$OVPN_OTP"
@costa
costa / docker-compose.yml
Last active July 23, 2021 07:12
Sample Docker Compose configuration for "staging" tests with OpenVPN
version: '3.4'
services:
open-vpn:
image: dperson/openvpn-client
cap_add:
- net_admin
devices:
- /dev/net/tun
dns: 8.8.4.4 # NOTE not sure how to make this generic
command: -d -a "$OVPN_USER;$OVPN_OTP"
@costa
costa / golang-docker-deps-up.sh
Last active April 13, 2020 10:23
Golang Module dependencies update with Docker
GOLANG_VERSION=1.14
docker run -v $(pwd)/go.mod:/b/go.mod -v $(pwd)/go.sum:/b/go.sum -w /build golang:$GOLANG_VERSION bash -c 'cp -a /b/go.mod /build/ && go mod downloa
d && cp -a /build/go.sum /b/'
@costa
costa / rust-docker-deps-up.sh
Last active April 11, 2020 15:01
Rust Cargo dependencies update with Docker
RUST_VERSION=1.42
docker run -v $(pwd)/Cargo.toml:/build/Cargo.toml -v $(pwd)/Cargo.lock:/build/Cargo.lock -w /build rust:$RUST_VERSION bash -c "mkdir src && touch src/main.rs && cargo update"
@costa
costa / map-section-to-esc-and-vice-versa-macos.sh
Created August 1, 2019 12:08
Map § (section sign) to esc (escape key) and vice versa (Apple UK keyboard, macOS 10.14, ABC input source)
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000064,"HIDKeyboardModifierMappingDst":0x700000029},{"HIDKeyboardModifierMappingSrc":0x700000029,"HIDKeyboardModifierMappingDst":0x700000064}]}'
@costa
costa / Dockerfile
Created February 6, 2019 14:33
kafka rest proxy helm chart ssl disability workaround (a part of)
FROM confluentinc/cp-kafka-rest:5.0.1
# NOTE the `*store`s should not be source-controlled and should be password-protected,
# so upon the helm chart deployment, the values should include (along with image/Tag):
# cp-kafka-rest:
# configurationOverrides:
# ssl.keystore.password:
# ssl.truststore.password:
# ssl.key.password:
# the "*store"s should be password-protected and the passwords must be supplied upon deployment