Skip to content

Instantly share code, notes, and snippets.

View pgreze's full-sized avatar

Pierrick Greze pgreze

View GitHub Profile
@mikehearn
mikehearn / plugin.xml
Created May 1, 2023 16:31
IntelliJ plugin xml for a kotlin scripting plugin
<idea-plugin>
<id>dev.hydraulic.hshell</id>
<name>Hydraulic Shell</name>
<vendor email="contact@hydraulic.software" url="https://hshell.hydraulic.dev">Hydraulic</vendor>
<description><![CDATA[
Hydraulic Shell is a replacement for shell scripting that uses Kotlin.
]]></description>
<depends>com.intellij.modules.platform</depends>
@mikehearn
mikehearn / gist:fdcb2c3ef30c6a2970d089fd8f860216
Created May 1, 2023 16:26
IntelliJ plugin to register a custom Kotlin scripting host
package hydraulic.hshell.intellij
import com.intellij.notification.NotificationGroupManager
import com.intellij.notification.NotificationType
import com.intellij.openapi.diagnostic.logger
import java.io.File
import java.io.IOException
import kotlin.script.experimental.intellij.ScriptDefinitionsProvider
private val LOG = logger<HShellDefinitionProvider>()
@wlib
wlib / LICENSE
Last active April 30, 2024 17:07
Run a shell script with bash, line-by-line, prompted on each command. Useful for running unknown scripts or debugging. Not a secure substitute for understanding a script beforehand.
MIT License
Copyright (c) 2021 Daniel Ethridge
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@adam-james-v
adam-james-v / vidwiz.clj
Last active January 22, 2023 09:42
Clojure/babashka script to help automate some of my video editing pipeline
#!/usr/bin/env bb
(ns vidwiz.main
"This is a prototype script for automating a portion of my video editing using ffmpeg."
(:require [clojure.java.shell :refer [sh]]
[clojure.string :as st]
[cheshire.core :refer [parse-string]]))
;; util
(defn get-extension
@ronshapiro
ronshapiro / dagger-android-view.md
Last active April 24, 2024 00:19
dagger.android for views in ~10 minutes

1. You can implement View.getActivity() like this:

public interface ViewWithActivity {
  // Using android-gradle-plugin 3.0, which has the desugar step for default methods on interfaces
  default Activity getActivity() {
    // https://android.googlesource.com/platform/frameworks/support/+/03e0f3daf3c97ee95cd78b2f07bc9c1be05d43db/v7/mediarouter/src/android/support/v7/app/MediaRouteButton.java#276
    Context context = getContext();
    while (context instanceof ContextWrapper) {
      if (context instanceof Activity) {
@ckirkendall
ckirkendall / clojure-match.clj
Created June 15, 2012 02:26 — forked from bkyrlach/Expression.fs
Language Compare F#, Ocaml, Scala, Clojure, Ruby and Haskell - Simple AST example
(use '[clojure.core.match :only [match]])
(defn evaluate [env [sym x y]]
(match [sym]
['Number] x
['Add] (+ (evaluate env x) (evaluate env y))
['Multiply] (* (evaluate env x) (evaluate env y))
['Variable] (env x)))
(def environment {"a" 3, "b" 4, "c" 5})