Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
#
# scale-gnome: Utiltity for HDPI screens. Gnome settings only support integer scale values. This uses xrandr to scale to fractional values.
#
usage() {
cat << EOF
Usage: scale-gnome [-o|--output <output>] [-d|--dry-run] <scale>
-o, --output: The xrandr output of the display to update. If not provided the output for the first connected screen found is used.
<template name="wip" value="@WorkInProgress(until=&quot;$UNTIL$&quot;, by=&quot;$WHO$&quot;, someConfigurationsMayPass = $WILL_IT_PASS$)&#10;" description="@WorkInProgress" toReformat="false" toShortenFQNames="true">
<variable name="UNTIL" expression="date()" defaultValue="" alwaysStopAt="true" />
<variable name="WHO" expression="user()" defaultValue="" alwaysStopAt="true" />
<variable name="WILL_IT_PASS" expression="" defaultValue="&quot;true&quot;" alwaysStopAt="true" />
<context>
<option name="KOTLIN" value="true" />
</context>
</template>
<template name="test" value="@org.junit.Test&#10;fun `$TEST_NAME$`() {&#10; $END$&#10;}" description="JUnit Test" toReformat="true" toShortenFQNames="true" useStaticImport="true">
<variable name="TEST_NAME" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="KOTLIN" value="true" />
</context>
</template>
<template name="todo" value="// TODO [$WHO$ $WHEN$] - $END$" description="ToDo" toReformat="true" toShortenFQNames="true" useStaticImport="true">
<variable name="WHO" expression="user()" defaultValue="" alwaysStopAt="true" />
<variable name="WHEN" expression="date()" defaultValue="" alwaysStopAt="false" />
<context>
<option name="JAVA_CODE" value="true" />
<option name="KOTLIN" value="true" />
</context>
</template>
@maxmil
maxmil / gist:2c1f7871caaf014d6a051b0059bb562f
Created May 20, 2018 14:31
ScheduleAtFixedRate builds up a queue when executions take longer than the delay between runs
import java.time.Instant
import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicInteger
fun main(args: Array<String>) {
val c = AtomicInteger(10)
Executors.newSingleThreadScheduledExecutor().scheduleAtFixedRate({ ->
println(Instant.now())
if (c.decrementAndGet() > 0) Thread.sleep(2000)