Skip to content

Instantly share code, notes, and snippets.

@asmega
asmega / gist:3a57a63c5fdf5e2de0acdffb681b7d6f
Created December 23, 2023 10:30
add fingerprint to known hosts
ssh-keyscan -H YOUR.IP.GOES.HERE >> ~/.ssh/known_hosts
@asmega
asmega / process.rb
Last active September 18, 2022 15:32
ticktick csv export
require "csv"
require "pry"
rows = CSV.read("./ticktick.csv", headers: true)
rows = rows.select { |row| row["Completed Time"].nil? }
CSV.open("./ticktick2.csv", "w") do |csv|
csv << rows[0].headers
rows.each do |row|
@asmega
asmega / index.sh
Created July 31, 2022 18:26
mac resize disk image
hdiutil resize -size 30g ~/path/to/file.sparsebundle
# HELP
hdiutil resize -help
@asmega
asmega / gist:cff2c3ba56a23e3cf8d7
Last active December 12, 2021 17:02
static site
wget -k -E -r -l 10 -p -N -F -nH http://localhost:3000
wget -P build -k -E -r -l 10 -p -N -F -nH http://localhost:3000
@asmega
asmega / gist:7cd47caafc02a0ff51d83444ce98e014
Last active July 9, 2021 12:23
simplest way to upload csv google bigquery
docker pull google/cloud-sdk:latest
docker run --rm -it docker.io/google/cloud-sdk:latest
gcloud auth activate-service-account --key-file=/google-service-account.json
# auto detect csv headers
# replace table contents with csv file
bq load --autodetect --replace mydb.mytable /data.csv

docker

Delete all containers

docker rm container $(docker ps -a -q)

Delete all images

@asmega
asmega / .curlrc
Created October 27, 2011 12:38
default proxy for curl in .curlrc
proxy=http://username:password@host:port
@asmega
asmega / script.sh
Created November 23, 2020 11:57
prevent rails from logging to stdout
unset RAILS_LOG_TO_STDOUT
# list indexes
curl -X GET "localhost:9200/_aliases"
# remove readonly
curl -X PUT "localhost:9200/recipes/_settings" -H 'Content-Type: application/json' -d'
{
"index": {
"blocks.read_only": false,
PGDATA=/usr/local/var/postgres pg_ctl start
// psql client commands
SHOW server_version;