Skip to content

Instantly share code, notes, and snippets.

SELECT total_params_tier
,AVG(logging_statements / total_repo_logging_statements) percent_out_of_total_repo_statements
,SUM(total_params) total_params
,SUM(logging_statements) logging_statements
,SUM(has_parameters) has_parameters
,SUM(has_concatenation) has_concatenation
,SUM(has_none) has_none
,SUM(has_both) has_both
,SUM(parameters_count) parameters_count
,SUM(concatenation_count) concatenation_count
SELECT sample_repo_name
,log_level
,CASE WHEN parametersCount + concatenationCount = 0 THEN "0"
WHEN parametersCount + concatenationCount = 1 THEN "1"
WHEN parametersCount + concatenationCount = 2 THEN "2"
WHEN parametersCount + concatenationCount = 3 THEN "3"
WHEN parametersCount + concatenationCount = 4 THEN "4"
WHEN parametersCount + concatenationCount >= 5 THEN "5+"
END total_params_tier
,SUM(parametersCount + concatenationCount) total_params
SELECT *
FROM [java-log-levels-usage:java_log_level_usage.top_repos_java_contents_lines_no_android_no_arduino]
WHERE REGEXP_MATCH(line, r'.*((LOGGER|Logger|logger|LOG|Log|log)[.](trace|info|debug|warn|warning|error|fatal|severe|config|fine|finer|finest)).*')
OR REGEXP_MATCH(line, r'.*((Level|Priority)[.](TRACE|TRACE_INT|X_TRACE_INT|INFO|INFO_INT|DEBUG|DEBUG_INT|WARN|WARN_INT|WARNING|WARNING_INT|ERROR|ERROR_INT)).*')
OR REGEXP_MATCH(line, r'.*((Level|Priority)[.](FATAL|FATAL_INT|SEVERE|SEVERE_INT|CONFIG|CONFIG_INT|FINE|FINE_INT|FINER|FINER_INT|FINEST|FINEST_INT|ALL|OFF)).*')
CountCatsInput input = new CountCatsInput();
input.setBucketName("pictures-of-cats");
input.setKey("three-cute-cats");
int cats = catService.countCats(input).getCount();
// equivalent to: turn(left).then(right)
turn left then right
// equivalent to: take(2.pills).of(chloroquinine).after(6.hours)
take 2.pills of chloroquinine after 6.hours
// equivalent to: select(all).unique().from(names)
select all unique() from names
show = { println it }
if {
// [#1145] Bind variables only for true prepared statements
// [#2414] Even if parameters are inlined here, child
// QueryParts may override this behaviour!
executePreparedStatements(c.settings()) &&
// [#1520] Renderers may enforce static statements, too
!Boolean.TRUE.equals(ctx.data(DATA_FORCE_STATIC_STATEMENT))) {
...
function killtomcat()
{
running_tomcats=ps -ef | grep org.apache.catalina.startup.Bootstrap | grep -v grep | awk '{ print $2 }' | tail -1
kill -9 $running_tomcats
}
function temp()
{
local root_dir=~/temp/temp
local date_seconds=date +%s
local temp_dir="$root_dir/$date_seconds"
mkdir -p "$temp_dir"
cd "$temp_dir"
}
function unzipAll()
{
for file in `ls | /bin/grep zip`; do
local base_name="${file%.*}"
rm -rf $base_name
mkdir $base_name
unzip $file -d $base_name
rm $file
done
}
function d2h()
{
printf "%x\n" $1
}