This file contains 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
#!/usr/bin/env bash | |
current_level=$(pmset -g batt|grep InternalBattery-0|sed -n 's#.*[[:space:]]\([[:digit:]]\{1,\}\)%.*#\1#p') | |
[[ -z ${current_level} ]] && current_level='--' | |
echo ${current_level} |
This file contains 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
#!/usr/bin/env bash | |
mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:get \ | |
-Dartifact=net.minidev:asm:1.0.2 \ | |
-DrepoUrl=https://mvnrepository.com/artifact/net.minidev/asm | |
exec jshell --class-path \ | |
~/.m2/repository/com/jayway/jsonpath/json-path/2.6.0/json-path-2.6.0.jar:\ | |
~/.m2/repository/net/minidev/json-smart/2.4.7/json-smart-2.4.7.jar:\ | |
~/.m2/repository/net/minidev/asm/1.0.2/asm-1.0.2.jar:\ |
This file contains 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
#!/usr/bin/env bash | |
ALL_REPOS=$(ls -1) | |
GIT_MAIN_EXECUTABLE="git" | |
GIT_PULL_CMDLINE="pull --all --ff" | |
GIT_FOLLBACK="pull --all --rebase" | |
echo $(pwd) | |
for i in ${ALL_REPOS}; do |
This file contains 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
SELECT | |
t.tablename, | |
indexname, | |
c.reltuples AS num_rows, | |
pg_size_pretty(pg_relation_size(quote_ident(t.tablename)::text)) AS table_size, | |
pg_size_pretty(pg_relation_size(quote_ident(indexrelname)::text)) AS index_size, | |
CASE WHEN indisunique THEN 'Y' | |
ELSE 'N' | |
END AS "UNIQUE", | |
idx_scan AS number_of_scans, |
This file contains 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
SELECT pid, age(clock_timestamp(), query_start), usename, query, state | |
FROM pg_stat_activity | |
WHERE state != 'idle' AND query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; |
This file contains 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
select | |
relname as relation_name, | |
query, | |
pg_locks.* | |
from pg_locks | |
join pg_class on pg_locks.relation = pg_class.oid | |
join pg_stat_activity on pg_locks.pid = pg_stat_activity.pid |
This file contains 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
SELECT | |
activity.pid, | |
activity.usename, | |
activity.query, | |
blocking.pid AS blocking_id, | |
blocking.query AS blocking_query | |
FROM pg_stat_activity AS activity | |
JOIN pg_stat_activity AS blocking ON blocking.pid = ANY(pg_blocking_pids(activity.pid)); |
This file contains 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
SELECT | |
pid, | |
user, | |
pg_stat_activity.query_start, | |
now() - pg_stat_activity.query_start AS query_time, | |
query, | |
state, | |
wait_event_type, | |
wait_event | |
FROM pg_stat_activity |
This file contains 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
#!/usr/bin/env bash | |
JQ=$(which jq) | |
[[ -n ${JQ} ]] || exit 1 | |
[[ -x ${JQ} ]] || exit 2 | |
brew info --json=v1 --installed | jq "map({name: .name, desc: .desc, version: .installed[].version})" |
This file contains 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
(ns com.myproject.model | |
(:require [honey.sql :as sql] | |
[clojure.string :as s])) | |
;; honeysql clause extension | |
;; Updates existing rows, and insert rows that don't exist. | |
;; If no key column is specified, the primary key columns are used to find the row. | |
;; If more than one row per new row is affected, an exception is thrown. |
NewerOlder