Skip to content

Instantly share code, notes, and snippets.

// Real code is down below (scroll):
// Reading the scala 3 documentation on macros (https://docs.scala-lang.org/scala3/guides/macros/macros.html) and trying out this example in that page:
/*
// ----- inspect.scala
def inspectCode(x: Expr[Any])(using Quotes): Expr[Any] =
println(x.show)
x

New to elvish and playing with the prompt, trying to set a fancy one with this prompt.elv

I am calling elvish ~/.elvish/prompt.elv in my rc.elv (Also tried calling prompt.elv directly at the prompt) but getting this error:

Exception: compilation error: cannot find variable $edit:prompt
~/.local/share/elvish/lib/github.com/zzamboni/elvish-themes/chain.elv, line 289:   set edit:prompt = $prompt~
~/.elvish/prompt.elv, line 16: use github.com/zzamboni/elvish-themes/chain
Exception: elvish exited with 2
~/.elvish/rc.elv, line 5: elvish ~/.elvish/prompt.elv
#!elvish
# Personalized based on the original prompt.elv shared by Kurtis Rader
# https://gist.github.com/krader1961/615003e1527950b84a9eef9a45ebcb08
# NOTES:-----------------------------------------------------------------
# Format of private variables: __variable-name__ Example: __host-name__
#
# See also:
# - https://github.com/zzamboni/elvish-themes/blob/master/chain.org#use
@vivekragunathan
vivekragunathan / scala-cli-cheatsheet.md
Last active October 22, 2021 18:45
scala-cli Cheatsheet

scala-cli Cheatsheet

Compile file(s) / folder

scala-cli compile Hello.scala

# Compile with dependent classes
scala-cli compile Hello.scala Includes.scala
@vivekragunathan
vivekragunathan / mysql.md
Created August 28, 2018 23:24
Useful MySQL queries

List all tables foreign-keyed to a certain table <schema>.<TBL> and column <tbl_id>

SELECT *
FROM
  KEY_COLUMN_USAGE
WHERE
  REFERENCED_TABLE_NAME = '<TBL>'
  AND REFERENCED_COLUMN_NAME = '<tbl_id>'
 AND TABLE_SCHEMA = '';
@vivekragunathan
vivekragunathan / git.md
Last active August 28, 2018 23:53
Handy git commands

Get Commits Between Dates

git log --after="2018-06-30" --before="2018-07-03" --oneline

Get {author}'s Branches

@vivekragunathan
vivekragunathan / redshift.md
Last active June 18, 2018 21:18
Handy RedShift Queries

show tables

SELECT DISTINCT tablename
FROM pg_table_def
WHERE schemaname = 'public'
ORDER BY tablename;
@vivekragunathan
vivekragunathan / uninstall_node_npm.sh
Last active February 19, 2019 16:38
Script to uninstall node and npm completely from your mac!
dump_dir_name="node_junk_`date +%s%N`"
dump_dir="${HOME}/Temp/${dump_dir_name}/"
echo "NODE/NPM UNINSTALLER v0.0.1
This uninstaller moves all the node/npm files and folders to ${dump_dir}.
Happy cleaning!
"
paths=(
# The main binaries / executables
@vivekragunathan
vivekragunathan / pbag_excerpt.php
Last active August 29, 2015 14:22
PHP PropertyBag Excerpt
<?
abstract class PropertyBag implements ArrayAccess {
protected $_store = null;
protected $_readOnly = false;
protected function __construct(&$source, $readOnly = false);
public static function fromArray(array &$source, $readOnly = false);
public static function fromObject($source, $readOnly = false);