Skip to content

Instantly share code, notes, and snippets.

View jesvs's full-sized avatar

Jesús Sánchez jesvs

View GitHub Profile
@jesvs
jesvs / legendary-0.20.1.ebuild
Created October 2, 2020 13:33
Legendary Epic launcher, Gentoo ebuild.
# Copyright 2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python3_8 )
inherit distutils-r1
MY_PN="legendary-gl"
MY_P="${MY_PN}-${PV}"
diff -Naur wine-5.9/dlls/ntdll/esync.c wine-fsync/dlls/ntdll/esync.c
--- wine-5.9/dlls/ntdll/esync.c 2020-08-10 01:37:43.417493835 -0600
+++ wine-fsync/dlls/ntdll/esync.c 2020-08-10 01:39:33.252766633 -0600
@@ -48,6 +48,7 @@
#include "ntdll_misc.h"
#include "esync.h"
+#include "fsync.h"
WINE_DEFAULT_DEBUG_CHANNEL(esync);
@jesvs
jesvs / mpcsimilar.sh
Last active June 1, 2023 20:44
Shell script that uses last.fm API to add similar artists to MPD.
#!/bin/bash
# depends on jq to parse json
# https://stedolan.github.io/jq/
#
# This script will query the last.fm API for
# similar artists based on the currently playing track.
# It will crop the current playlist, and shuffle the API results.
#
# You can configure 3 parameters:
@jesvs
jesvs / getBitmapFromDrawable.kt
Created October 23, 2019 23:57
Get a Bitmap from a Drawable resource id
fun getBitmapFromDrawable(resId: Int): Bitmap? {
val drawable = AppCompatResources.getDrawable(requireContext(), resId) ?: return null
val bitmap = Bitmap.createBitmap(
drawable.intrinsicWidth,
drawable.intrinsicHeight,
Bitmap.Config.ARGB_8888
)
val canvas = Canvas(bitmap)
drawable.setBounds(0, 0, canvas.width, canvas.height)
drawable.draw(canvas)
import kotlin.math.ln
import kotlin.math.pow
fun convertToSuffix(x: Double): String {
if (x < 1_000) return "$x"
val exp = (ln(x) / ln(1_000.0)).toInt()
return String.format("%.1f%c", x / 1_000.0.pow(exp), "kmgtpe".toCharArray()[exp - 1])
}
@jesvs
jesvs / ffmpeg-4.patch
Created July 10, 2018 11:17
Blender 2.79 ffmpeg 4.0.1 patch
--- a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp 2018-07-10 02:29:54.725788354 -0600
+++ b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp 2018-07-10 02:31:17.070473241 -0600
@@ -264,9 +264,9 @@
m_membuffer(buffer),
m_membufferpos(0)
{
- m_membuf = reinterpret_cast<data_t*>(av_malloc(FF_MIN_BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE));
+ m_membuf = reinterpret_cast<data_t*>(av_malloc(AV_INPUT_BUFFER_MIN_SIZE + AV_INPUT_BUFFER_PADDING_SIZE));
- m_aviocontext = avio_alloc_context(m_membuf, FF_MIN_BUFFER_SIZE, 0, this,
@jesvs
jesvs / proxy.go
Created March 5, 2018 18:09
Golang: Change the proxy net/http uses during execution.
package main
import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
)
// Go's net/http gets (and caches) the environment variable HTTP_PROXY
@jesvs
jesvs / index.html
Created October 9, 2017 11:43
CSS Image background preloader with fader
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Preload background image</title>
<style media="screen">
* {
box-sizing: border-box;
Pin Color Signal
1 BLACK GND
2 BLACK GND
3 RED ?
4 BLACK GND
5 YELLOW ENABLE
6 GREEN ADJUST
7 BLUE ?
8 BLACK GND
9 GREY VIN +12v
<application
android:name=".ParseApplication"
/>
<uses-permission android:name="android.permission.INTERNET" />