u/TooOldForShaadi
4 Electric Engines haul a container freight train on a bridge on top of a mountain
Country: India
This route is very famous and one of the most scenic mountain rides you can take in a tropical country.
This spot is easily 2000 ft above sea level.
There are 3 railway tracks on this route and they keep joining and separating from each other as you go from start to finish (Palasdhari to Khandala)
all lines are fully electrified as always
During monsoons, you'll see small streams of water falling everywhere on the mountain
For the more curious ones, here is what the journey looks like
230+ Free Services offered by other founders. This week you got AI Automation, Find first 10 users, Promo video for your SaaS, Tik Tok outreach, Market research, Conversion bottleneck analysis, SEO consulting and more...
- How are you guys doing? Its me again. Every week, I collect free services offered by other startup founders from across 200 subreddits and manually curate them into a list!
- This list now has 230+ free serives as of now. Mind you, this is not FREEMIUM stuff, not the FREE TIER stuff, not the SIGN UP on my webpage and I'll help you stuff.
- This is stuff the founders and consultants from all walks of life are willing to offer for your startup.
Roundup
- We got guys offering AI Automation setups and audits
- I see a lot of dudes doing tik tok outreach this week like basically promoting your startup on tik tok to a massive audience
- One guy s doing branding and another is doing logos
- There are also a couple of gigs offering to generate reels and videos for your SaaS
- Some are offering website, SEO and automation audits
I update every week, I kid you not
- I may not post here every week because I don't want to keep spamming but I don't stop updating like ever
- Been about 3 months now that I have been on this
Future Plans
- Get all this ported to my website with LLM powered search and tagging while still maintaining the github repo
- Maybe add an interface to submit free offers directly on the website?
Spread the word!
- Here is the FULL LINK TO THE REPO
- What are you waiting for? spread the word on every social platform!
Are you supposed to return 0 or 1 or anything from an EXIT trap handler?
#!/usr/bin/env bash
function handle_exit() {
validate_args_count 4 "$#" "${FUNCNAME[0]}" || return 1
local -r exit_code="$1"
local -r enable_logging="${2:-true}"
local -r archive_tar_path="$3"
local -r raw_dump_path="$4"
shift 4
validate_non_empty_arg "archive_tar_path" "${archive_tar_path}" "${FUNCNAME[0]}" || return 1
validate_non_empty_arg "enable_logging" "${enable_logging}" "${FUNCNAME[0]}" || return 1
validate_non_empty_arg "exit_code" "${exit_code}" "${FUNCNAME[0]}" || return 1
validate_non_empty_arg "raw_dump_path" "${raw_dump_path}" "${FUNCNAME[0]}" || return 1
validate_boolean_arg "enable_logging" "${enable_logging}" "${FUNCNAME[0]}" || return 1
validate_integer_arg "exit_code" "${exit_code}" "${FUNCNAME[0]}" || return 1
# Clean up the generated directory and the tar.gz file if they exist, since they are intermediate files and should not be kept after the dump process is completed
# Technically they should exist only on failure, since on success they should be removed by the tar and brotli commands, but we will clean them up just in case
[[ -d "${raw_dump_path}" ]] && rm -rf "${raw_dump_path}"
[[ -f "${archive_tar_path}" ]] && rm -f "${archive_tar_path}"
if [[ "${exit_code}" -ne 0 ]]; then
log_error "dump process failed with exit_code: %d\n" "${exit_code}"
else
[[ "${enable_logging}" = true ]] && log_info "dump process completed successfully with exit_code: %d\n" "${exit_code}"
fi
}
function main() {
// ... other lines
trap "handle_exit \$? \"${enable_logging}\" \"${archive_tar_path}\" \"${raw_dump_path}\"" EXIT
// ... other lines
}
- I did ask AI before anyone points out. Some of them say you should return 0 for good and 1 for error conditions. Others say it is not a good idea to return exit codes from a trap handler. Hence, asking the human experts here?
- You got an EXIT trap handler and something goes wrong inside it...
- Are you supposed to return 0 or 1 from it or should you just pretend nothing happened?
5 Diesel Engines haul cargo straight through a waterfall!
Triple Electric Engines haul freight at the top of a mountain 2000 ft above sea level
Taken somewhere in south india from this train journey here by OP (not me)
function run_psql() {
local -r enable_logging="${1:-true}"
local -r dbname="$2"
local -r host="$3"
local -r port="$4"
local -r username="$5"
local -r command="$6"
shift 6
[[ "${enable_logging}" = true ]] && log_info "Starting psql command for dbname: %s, host: %s, port: %s, username: %s, command: %s\n" "${dbname}" "${host}" "${port}" "${username}" "${command}"
local result
if result="$(psql \
--dbname="${dbname}" \
--host="${host}" \
--port="${port}" \
--username="${username}" \
--command="${command}" \
--no-align \
--tuples-only)"; then
[[ "${enable_logging}" = true ]] && log_info "psql command completed successfully for dbname: %s, host: %s, port: %s, username: %s, command: %s\n" "${dbname}" "${host}" "${port}" "${username}" "${command}"
else
log_error "psql command failed for dbname: %s, host: %s, port: %s, username: %s, command: %s\n" "${dbname}" "${host}" "${port}" "${username}" "${command}"
return 1
fi
# If the result is empty for any reason, we return an empty JSON array to avoid issues with downstream processing
[[ -z "${result}" ]] && result="[]"
printf "%s" "${result}"
}
function run_jq() {
local -r enable_logging="${1:-true}"
local -r key="$2"
local -r value="$3"
local -r template="$4"
shift 4
[[ "${enable_logging}" = true ]] && log_info "Starting jq for key: %s, template: %s\n" "${key}" "${template}"
if jq --null-input --argjson "${key}" "${value}" "${template}"; then
[[ "${enable_logging}" = true ]] && log_info "jq completed successfully for key: %s, template: %s\n" "${key}" "${template}"
return 0
else
log_error "jq failed for key: %s, template: %s\n" "${key}" "${template}"
return 1
fi
}
function main() {
local -r command_read_row_counts="
SELECT
json_agg(row)
FROM
(
WITH tbl AS
(
SELECT
table_schema,
table_name
FROM
information_schema.tables
WHERE
table_name NOT LIKE 'pg_%'
AND table_schema IN
(
'public'
)
)
SELECT
table_name,
(
xpath('/row/c/text()', query_to_xml(format('select count(*) as c from %I.%I', table_schema, table_name), FALSE, TRUE, ''))
)
[1]::text::INT AS rows_n
FROM
tbl
ORDER BY
table_name ASC
) row;
"
# ...unrelated lines
result=$(
run_psql \
"${enable_logging}" \
"${dbname}" \
"${host}" \
"${port}" \
"${username}" \
"${command_read_row_counts}"
) || return 1
# ...unrelated lines
# shellcheck disable=SC2016
contents=$(
run_jq \
"${enable_logging}" \
"tables" \
"${result}" \
'{tables:$tables}'
) || return 1
# ... unrelated lines
}
- When enable_logging=false everything works perfectly
- When enable_logging=true jq blows up, any ideas how to fix this?
function _log() {
local level="$1"
local color="$2"
local stream="$3"
shift 3
local fmt="$1"
shift
local reset='\033[0m'
local timestamp
timestamp="$(date -u '+%Y-%m-%d %H:%M:%S %z')"
local colored_level="${color}${level}${reset}"
local message
# shellcheck disable=SC2059
printf -v message -- "${fmt}" "$@"
local line="[${timestamp}] ${colored_level} ${message}"
if [[ "${stream}" == "stderr" ]]; then
printf '%b\n' "${line}" >&2
else
printf '%b\n' "${line}"
fi
}
function log_info() {
local blue='\033[0;34m'
_log "INFO" "${blue}" "stdout" "$@"
}
function log_warn() {
local yellow='\033[0;33m'
_log "WARN" "${yellow}" "stdout" "$@"
}
function log_error() {
local red='\033[0;31m'
_log "ERROR" "${red}" "stderr" "$@"
}
Basically I would like to have a logger sorta thing, you know with INFO, ERROR and WARN for now with different colors etc for bash
- It should be able to handle log_info "%s is %d" "number" 10
- Apart from printing timestamps, redirecting error logs to stderr etc
What do you think about this implementation? Good enough or needs improvements?
Could ask an AI easily but I am looking for human opinions here