Skip to content

Instantly share code, notes, and snippets.

@cosic
cosic / mirakle.sh
Last active June 7, 2021 12:50
Mirakle Activation Script
#!/bin/bash
###############################################
# How to use from terminal:
# $> mirakle.sh on – to enable
# $> mirakle.sh off – to disable
###############################################
MIRAKLE_INIT_SCRIPT_DIR="${HOME}/.gradle/init.d/"
MIRAKLE_INIT_SCRIPT_FILE="${MIRAKLE_INIT_SCRIPT_DIR}/mirakle_init.gradle"
@grahampugh
grahampugh / Adobe CC Cleaner-postinstall.sh
Created November 18, 2019 15:06
A script to clean up properly the things that Adobe CC Cleaner fails to remove.
#!/bin/bash
## postinstall script to remove CCDA applications
# remove any existing version of the tool
echo "Moving the CC Cleaner app to Utilities in case users need it later"
rm -rf /Applications/Utilities/Adobe\ Creative\ Cloud\ Cleaner\ Tool.app ||:
mv /Applications/Adobe\ Creative\ Cloud\ Cleaner\ Tool.app /Applications/Utilities/Adobe\ Creative\ Cloud\ Cleaner\ Tool.app
# run the cleaner tool to remove EVERYTHING!
echo "Running the CC Cleaner app with 'removeAll=All' option"
@filipkowicz
filipkowicz / HeaderItemDecoration.kt
Last active April 19, 2024 15:37
Item Decorator for sticky headers in Kotlin
package com.filipkowicz.headeritemdecorator
/*
solution based on - based on Sevastyan answer on StackOverflow
changes:
- take to account views offsets
- transformed to Kotlin
- now works on viewHolders
@StefanDeBruijn
StefanDeBruijn / ChangeOutlineRadius.kt
Last active November 28, 2022 14:43
Custom animation
import android.animation.Animator
import android.animation.ObjectAnimator
import android.annotation.TargetApi
import android.content.Context
import android.graphics.Outline
import android.os.Build
import android.transition.Transition
import android.transition.TransitionValues
import android.util.AttributeSet
import android.util.Property
@jivimberg
jivimberg / takeWhileInclusive.kt
Last active December 18, 2020 10:36
Inclusive implementation of takeWhile for Kotlin. Inspired from this gist: https://gist.github.com/matklad/54776705250e3b375618f59a8247a237 . Read more about this implementation on my blog: https://jivimberg.io/blog/2018/06/02/implementing-takewhileinclusive-in-kotlin/
// kotlin.collections
inline fun <T> Array<out T>.takeWhileInclusive(
predicate: (T) -> Boolean
): List<T> {
var shouldContinue = true
return takeWhile {
val result = shouldContinue
shouldContinue = predicate(it)
result
@omarmiatello
omarmiatello / Yeelight.kt
Last active December 5, 2020 11:07
Yeelight API in Kotlin. Add support for multiple light!
package gdax.notification
import gdax.conf.App
import gdax.utils.logV
import kotlinx.coroutines.experimental.*
import java.io.BufferedOutputStream
import java.io.BufferedReader
import java.io.InputStreamReader
import java.net.DatagramPacket
import java.net.DatagramSocket
@shau-lok
shau-lok / add local aar file.md
Last active January 20, 2022 08:23
Android Studio add local .aar reference

Add local .aar file

  1. basic build.gradle directory using flatDir
repositories {
    mavenCentral()
    flatDir {
 dirs 'libs'
@qerub
qerub / lifx-sunrise-simulator.rb
Last active September 9, 2020 11:44
LIFX Sunrise Simulator
require "lifx" # http://www.rubydoc.info/gems/lifx
def calculate_color(i) # 0 <= i <= 1
h = [40 * 2 * i, 40].min # will be 40 (yellow) at i=1/2 and stay there
s = 1.0 - [(i - 0.5) * 2, 0].max # will be 1 until i=1/2 and then go down to 0
b = i
LIFX::Color.hsbk(h, s, b, LIFX::Color::KELVIN_MIN)
end
duration = 10 * 60 # seconds