Skip to content

Instantly share code, notes, and snippets.

View DevSrSouza's full-sized avatar

Gabriel Souza DevSrSouza

View GitHub Profile
@DevSrSouza
DevSrSouza / Mineradora.java
Last active March 30, 2020 03:48
Mineradora Exemplo
import org.bukkit.*;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Mineradora implements CommandExecutor{
private MineradoraThread thread = null;
@DevSrSouza
DevSrSouza / JsonItemStack.java
Created December 3, 2017 01:48
Parse Bukkit ItemStack to JSON
import com.google.gson.*;
import org.bukkit.Color;
import org.bukkit.DyeColor;
import org.bukkit.FireworkEffect;
import org.bukkit.Material;
import org.bukkit.block.banner.Pattern;
import org.bukkit.block.banner.PatternType;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
@DevSrSouza
DevSrSouza / android-sdk-linux-cli
Created December 28, 2017 19:12 — forked from rikyperdana/android-sdk-linux-cli
Ubuntu 14.04 command line install android sdk
# install openjdk
sudo apt-get install openjdk-7-jdk lib32stdc++6 lib32z1
# download android sdk
wget http://dl.google.com/android/android-sdk_r24.2-linux.tgz
tar -xvf android-sdk_r24.2-linux.tgz
# install all sdk packages
cd android-sdk-linux/tools
./android update sdk --no-ui
@DevSrSouza
DevSrSouza / ClassYamlConfiguration.java
Created May 31, 2018 06:33
Class deserializer and serialiazer to YAML
import org.bukkit.configuration.file.FileConfiguration;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.Function;
import java.util.stream.Collectors;

gif-from-tweet

There are so many great GIFs out there and I want to have copies of them. Twitter makes that harder than it should be by converting them to MP4 and not providing access to the source material. To make it easier, I made a bash pipeline that takes a tweet URL and a filename, extracts the MP4 from that tweet and uses ffmpeg to convert back to GIF.

Dependencies

  • ffmpeg: brew install ffmpeg

Install

package br.com.devsrsouza.souzaeconomy
import com.zaxxer.hikari.HikariDataSource
import com.zaxxer.hikari.HikariConfig
import java.io.File
import java.io.FileOutputStream
import java.io.IOException
import java.lang.reflect.InvocationTargetException
import java.net.*
import java.sql.SQLException
@DevSrSouza
DevSrSouza / Config.kt
Last active December 24, 2018 16:08
Config helper for KotlinBukkitAPI
import br.com.devsrsouza.kotlinbukkitapi.dsl.config.YamlConfig
import br.com.devsrsouza.kotlinbukkitapi.dsl.config.loadAndSetDefault
import br.com.devsrsouza.kotlinbukkitapi.dsl.config.loadTransformerChangeColor
import br.com.devsrsouza.kotlinbukkitapi.dsl.config.saveTransformerChangeColor
import org.bukkit.plugin.Plugin
import java.io.File
import kotlin.reflect.KClass
fun Plugin.configLazy(file: String, model: KClass<*>) = lazy {
File(dataFolder, file).let {
@DevSrSouza
DevSrSouza / ArgumentDSL.kt
Created December 3, 2018 11:58
Old idea of Arguments for KotlinBukkitAPI
package br.com.devsrsouza.kotlinbukkitapi.dsl.command
import br.com.devsrsouza.kotlinbukkitapi.extensions.text.asText
import br.com.devsrsouza.kotlinbukkitapi.extensions.text.color
import br.com.devsrsouza.kotlinbukkitapi.extensions.text.unaryPlus
import net.md_5.bungee.api.chat.TextComponent
import org.bukkit.Bukkit
import org.bukkit.ChatColor
import org.bukkit.Location
import org.bukkit.World
@DevSrSouza
DevSrSouza / GsonDSL.kt
Created January 30, 2019 16:09
A json DSL builder for google gson library.
import com.google.gson.JsonArray
import com.google.gson.JsonElement
import com.google.gson.JsonObject
import com.google.gson.JsonPrimitive
@DslMarker
annotation class JsonMarker
@JsonMarker
fun json(block: JsonObjectBuilder.() -> Unit): JsonObject {
@DevSrSouza
DevSrSouza / build.gradle
Created February 6, 2019 19:54
Kotlin + Spigot 1.8.8 + Minecraft dev IntelliJ Plugin
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.3.20'
id 'com.github.johnrengelman.shadow' version '4.0.3'
}
group = pluginGroup
version = pluginVersion
sourceCompatibility = 1.8