Skip to content

Instantly share code, notes, and snippets.

Privacy Policy

This privacy policy applies to the Game Dev Story Help app (hereby referred to as "Application") for mobile devices that was created by Tsuharesu (hereby referred to as "Service Provider") as a Free service. This service is intended for use "AS IS".

What information does the Application obtain and how is it used?

The Application does not obtain any information when you download and use it. Registration is not required to use the Application.

Does the Application collect precise real time location information of the device?

@tsuharesu
tsuharesu / tsu_edit.sh
Last active June 13, 2025 19:35
Image edit with ImageMagick
#!/bin/bash
# This script processes photos in a specified input directory, applying a blur effect, resizing, adding a border, and overlaying a watermark.
# Requirements: ImageMagick must be installed and accessible via the 'magick' command.
# Receive the input directory as a parameter or use the default value.
INPUT_DIR="${1:-input}"
# Ensure the input directory exists
if [ ! -d "$INPUT_DIR" ]; then
echo "Input directory '$INPUT_DIR' does not exist."
@tsuharesu
tsuharesu / words_from_the_heart.slackworkflow
Last active November 3, 2020 20:51
A simple workflow to send some kind anonymous words for your colleagues.
{
"source_id": "302598399050397860",
"version": "1",
"workflow": {
"name": "Words from the Heart",
"blueprint": {
"version": "1",
"trigger": {
"type": "channel_action",
"id": "4bde8971-a75a-4310-b5ec-efceeea0a91a",
@tsuharesu
tsuharesu / rotation.kt
Created July 2, 2019 15:01
Rotate image after saving with CameraX
/** Define callback that will be triggered after a photo has been taken and saved to disk */
private val imageSavedListener = object : ImageCapture.OnImageSavedListener {
override fun onError(error: ImageCapture.UseCaseError, message: String, exc: Throwable?) {
exc?.printStackTrace()
}
override fun onImageSaved(photoFile: File) {
lifecycle.coroutineScope.launch {
rotateImageCorrectly()
}
override fun start() {
program.accept(LoadLabelsMsg)
program.accept(LoadAccountsMsg)
}
override fun resume() {
}
override fun destroy() {
programDisposable.dispose()
@tsuharesu
tsuharesu / AccountActivity.kt
Last active January 15, 2016 13:02
ViewBinder usage
class AccountActivity : AccountView {
lateinit var presenter: AccountPresenter
// Using the ViewBinder is simple
override var accountView: AccountViewModel by ViewBinder {
txt_username.text = it.userName
txt_company.text = it.company
txt_contact_email.text = it.email
txt_contact_phone.text = it.phone
@tsuharesu
tsuharesu / Binding.kt
Last active January 9, 2016 17:20
Kotlin ViewBinder for Android
/**
* View binder with nullable types support
*/
class ViewBinder<M>(val function: (M) -> Unit) : ReadWriteProperty<Any, M> {
private var mValue: M? = null
override fun getValue(thisRef: Any, property: KProperty<*>): M {
return mValue as M
}
@tsuharesu
tsuharesu / AddCookiesInterceptor.java
Last active June 8, 2024 07:30
Handle Cookies easily with Retrofit/OkHttp
/**
* This interceptor put all the Cookies in Preferences in the Request.
* Your implementation on how to get the Preferences MAY VARY.
* <p>
* Created by tsuharesu on 4/1/15.
*/
public class AddCookiesInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
@tsuharesu
tsuharesu / stream_fibonacci.exs
Created March 23, 2015 22:21
Fibonacci via Stream
# Generate a stream
Stream.unfold({0, 1}, fn {a, b} -> {a, {b, a + b}} end)
# Take the first 15 numbers
|> Enum.take(15)
@tsuharesu
tsuharesu / fizzbuzz.exs
Created March 19, 2015 01:10
Fizzbuzz in Elixir
# This is a exercise in Programming Elixir from Pragmatic Bookshelf
fizzbuzz_check = fn
(0, 0, _) -> "FizzBuzz"
(0, _, _) -> "Fizz"
(_, 0, _) -> "Buzz"
(_, _, c) -> c
end
fizzbuzz = fn(n) -> fizzbuzz_check.(rem(n, 3), rem(n, 5), n) end