Skip to content

Instantly share code, notes, and snippets.

# ---
# output-directory: "/tmp/stable-diffusion"
# ---
# # Stable diffusion slackbot
#
# This tutorial shows you how to build a Slackbot that uses
# [stable diffusion](https://stability.ai/blog/stable-diffusion-public-release)
# to produce realistic images from text prompts on demand.
#
# ![stable diffusion slackbot](./stable_diff_screenshot.jpg)
@scottjg
scottjg / xplanet-giflib5.patch
Created January 31, 2015 05:05
patch for xplanet 1.3.0 with giflib5
--- xplanet-1.3.0.orig/src/libimage/gif.c 2006-03-25 14:50:51.000000000 -0800
+++ xplanet-1.3.0/src/libimage/gif.c 2015-01-30 21:01:52.000000000 -0800
@@ -28,6 +28,18 @@
distribution.
*/
+#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5
+void
+PrintGifError(int ErrorCode) {
+ const char *Err = GifErrorString(ErrorCode);
@scottjg
scottjg / vice-giflib5.patch
Last active August 29, 2015 14:14
patch for vice 2.4 with giflib5
diff -ru vice-2.4.orig/src/gfxoutputdrv/gifdrv.c vice-2.4/src/gfxoutputdrv/gifdrv.c
--- vice-2.4.orig/src/gfxoutputdrv/gifdrv.c 2015-01-30 18:55:20.000000000 -0800
+++ vice-2.4/src/gfxoutputdrv/gifdrv.c 2015-01-30 19:29:56.000000000 -0800
@@ -42,10 +42,16 @@
#if GIFLIB_MAJOR >= 5
#define VICE_EGifOpenFileName(x, y, z) EGifOpenFileName(x, y, z)
+#if GIFLIB_MINOR >= 1
+#define VICE_EGifCloseFile(x) EGifCloseFile(x, NULL)
+#else
@scottjg
scottjg / imlib2-giflib.patch
Last active August 29, 2015 14:14
patch for imlib2 1.4.6 to work with giflib5
diff -ru imlib2-1.4.6.orig/src/modules/loaders/loader_gif.c imlib2-1.4.6/src/modules/loaders/loader_gif.c
--- imlib2-1.4.6.orig/src/modules/loaders/loader_gif.c 2015-01-30 18:32:56.000000000 -0800
+++ imlib2-1.4.6/src/modules/loaders/loader_gif.c 2015-01-30 18:35:59.000000000 -0800
@@ -36,7 +36,11 @@
#endif
if (fd < 0)
return 0;
+#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5
+ gif = DGifOpenFileHandle(fd, NULL);
+#else
@scottjg
scottjg / swftools-giflib5.patch
Last active August 29, 2015 14:14
patch for swftools 0.9.2 and giflib5
diff -ru swftools-0.9.2.orig/src/gif2swf.c swftools-0.9.2/src/gif2swf.c
--- swftools-0.9.2.orig/src/gif2swf.c 2011-01-01 19:30:29.000000000 -0800
+++ swftools-0.9.2/src/gif2swf.c 2015-01-30 17:17:10.000000000 -0800
@@ -65,6 +65,17 @@
RESTORE_TO_PREVIOUS
};
+#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5
+void
+PrintGifError(int ErrorCode) {
@scottjg
scottjg / mapserver-giflib5.patch
Last active August 29, 2015 14:14
patch to compile mapserver 6.2.1 with giflib 5.x
--- mapserver-6.2.1.orig/mapimageio.c 2013-04-19 21:08:49.000000000 -0700
+++ mapserver-6.2.1/mapimageio.c 2015-01-30 16:47:46.000000000 -0800
@@ -994,11 +994,18 @@
}
}
#ifdef USE_GIF
+#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5
+#define gif_error_msg() _gif_error_msg(image->Error)
+static char const *_gif_error_msg(int code)
+#else
#!/usr/bin/env ruby
require 'date'
prev_dt = nil
prev_line = nil
$stdin.each_line do |line|
time_str = line[1..25]
dt = DateTime.parse(time_str) rescue next
if prev_dt != nil
#include <stdio.h>
#include <curl/curl.h>
int main(void)
{
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
#!/usr/bin/env ruby
print "Content-type: image/png\n\n"
pid = Process.pid
#id = `/Users/hubotvoicebox/GetWindowID "Airfoil Speakers" "Airfoil Speakers" 2>/dev/null`.rstrip
id = 322
`screencapture -l#{id} /tmp/airfoil.#{pid}.png`
print `cat /tmp/airfoil.#{pid}.png`
`rm /tmp/airfoil.#{pid}.png`
test