Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Julia fuzzyweapon

🎯
Focusing
View GitHub Profile
@fuzzyweapon
fuzzyweapon / Ducky_One_2_Mini.md
Last active Feb 11, 2021
Ducky One 2 Mini Troubleshooting
View Ducky_One_2_Mini.md

Solved

"Bricked" (startup bug)

Steps for Repro

  1. Put into demo mode: LCTRL + CAPSLOCK + TAB 3 seconds on startup
  2. Unplug
@fuzzyweapon
fuzzyweapon / tut-adv-0-intro.md
Last active Dec 10, 2020
An advanced tutorial for Atlantis
View tut-adv-0-intro.md

Advanced Techniques Tutorial

If anyone is interested in more tutorials of things they find mentioned here or would like a sample set of settings files with instructions on how to safely try it out, let me know! ~monkey/fuzzyweapon

Please use the comments section (if you can) to provide feedback, corrections, improvements.


In this guide, we'll be stepping through a tutorial that demonstrates some advanced techniques.

View 01-forgetful_basics.md

Forgetful Basics

These are things I often need to use but forget. They aren't tricky or difficult, just reminders. * denotes a recommended method.

Return an empty/blank result...
Use `IFERROR(0/0)`
  IF(TRUE(),"blah",IFERROR(0/0))
@fuzzyweapon
fuzzyweapon / test-stdin-programmatic.sh
Created May 22, 2019
Set stdin programatically for a bash file. Useful for testing
View test-stdin-programmatic.sh
set -- each one of us is a part of STDIN
@fuzzyweapon
fuzzyweapon / load-env-posix.sh
Last active May 22, 2019
Load a .env file - environment variable flat files
View load-env-posix.sh
set -a; . conf-file; set +a
@fuzzyweapon
fuzzyweapon / preserve-last-modified.build.gradle.kts
Created Oct 13, 2018
Preserve last modified in copy actions in Gradle without using ant.copy task.
View preserve-last-modified.build.gradle.kts
// From https://github.com/gradle/kotlin-dsl/blob/70aca202558f2f6e43cd8ead3ec95d669bfd7b33/build.gradle.kts#L69
// Preserve file modified dates without using ant.copy task
val copyCurrentDistro by task<Copy> {
description = "Copies the current Gradle distro into '$customInstallationDir'."
from(gradle.gradleHomeDir)
into(customInstallationDir)
exclude("**/*kotlin*")
// preserve last modified date on each file to make it easier
@fuzzyweapon
fuzzyweapon / pretty-tasks.build.gradle.kts
Created Oct 13, 2018
Helper function for making registering callsites pretty.
View pretty-tasks.build.gradle.kts
// --- Utility functions -----------------------------------------------
inline fun <reified T : Task> task(noinline configuration: T.() -> Unit) =
tasks.registering(T::class, configuration)
// Usage
val customInstallation by task<Copy> {
description = "Copies latest gradle-kotlin-dsl snapshot over the custom installation."
dependsOn(copyCurrentDistro)
from(distribution)
into("$customInstallationDir/lib")
View Standard.kt
/**
* Returns `this` value if it satisfies the given [predicate] or `null`, if it doesn't.
*/
@kotlin.internal.InlineOnly
@SinceKotlin("1.1")
public inline fun <T> T.takeIf(predicate: (T) -> Boolean): T? {
contract {
callsInPlace(predicate, InvocationKind.EXACTLY_ONCE)
}
return if (predicate(this)) this else null
View changingProjectSourceLayout.kts
// Sub-project or project build.gradle.kts
// This is for KotlinJVM and KotlinJVM multiplatform build.gradle.kts
java.sourceSets["main"].withConvention(KotlinSourceSet::class) {
kotlin.srcDir(file("src"))
}
java.sourceSets["test"].withConvention(KotlinSourceSet::class) {
kotlin.srcDir(file("test"))
}
View central_plugin_version-settings.gradle.kts
pluginManagement {
// ...
resolutionStrategy {
eachPlugin {
// plugin substitution
if (requested.id.id == "com.android.application") {
useModule("com.android.tools.build:gradle:${requested.version}")
}
// plugin version substitution
if (requested.id.id.startsWith("org.jetbrans.kotlin")) {