Skip to content

Instantly share code, notes, and snippets.

View grigorye's full-sized avatar

Grigory Entin grigorye

  • Almere, Netherlands
View GitHub Profile
@grigorye
grigorye / EnumNamed.swift
Created February 15, 2018 00:34
Recover Swift enum given its name (in case you can not have String as RawValue)
//: Playground - noun: a place where people can play
extension RawRepresentable where RawValue: BinaryInteger {
init?(named name: String, from lower: Self, to upper: Self) {
var i = lower.rawValue
repeat {
let x = Self(rawValue: i)!
guard "\(x)" != name else {
self = x
[default]
signing_required=false
@grigorye
grigorye / minidlna-1.2.1-sdl_alen-0-8.diff
Last active October 6, 2017 20:16
Workaround for minidlna crashing on macOS 10.13 (17A405)
diff -ur minidlna-1.2.1/getifaddr.c minidlna-1.2.1-sdl_alen-0-8/getifaddr.c
--- minidlna-1.2.1/getifaddr.c 2017-08-24 19:28:25.000000000 +0200
+++ minidlna-1.2.1-sdl_alen-0-8/getifaddr.c 2017-10-06 22:05:06.000000000 +0200
@@ -206,6 +206,10 @@
#else
struct sockaddr_dl *sdl;
sdl = (struct sockaddr_dl*)p->ifa_addr;
+ if (sdl->sdl_alen == 0)
+ continue;
+ if (6 < sdl->sdl_alen)
@grigorye
grigorye / .monitrc
Last active October 4, 2017 05:59
Config file for https://mmonit.com/monit/ to kill SourceKitService when it ends up eating all the memory
set daemon 30
check process SourceKitService matching "SourceKitService"
if memory > 2 GB then exec "/usr/bin/killall -9 SourceKitService"
repeat every 1 cycle
mode passive
diff -ur minidlna-1.2.1/albumart.c minidlna-1.2.1-cover-resize/albumart.c
--- minidlna-1.2.1/albumart.c 2017-08-24 19:28:25.000000000 +0200
+++ minidlna-1.2.1-cover-resize/albumart.c 2017-09-10 00:34:02.000000000 +0200
@@ -67,15 +67,18 @@
strncpyt(cache_dir, cache_file, sizeof(cache_dir));
make_dir(dirname(cache_dir), S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH);
+ if( runtime_vars.cover_size <= 0 )
+ return image_save_to_jpeg_file(imsrc, cache_file);
+
@grigorye
grigorye / minidlna-ssdp-1.1.5-no-mcast-addr.diff
Last active August 8, 2017 23:14
Patch for minidlna (1.1.15 or later) that otherwise fails with "minissdp.c:261: error: sendto(udp): Can't assign requested address" on MacOS
--- minidlna-1.1.5/minissdp.c~orig 2015-09-10 21:24:09.000000000 +0200
+++ minidlna-1.1.5/minissdp.c 2017-08-09 01:03:45.000000000 +0200
@@ -113,11 +113,16 @@
memset(&sockname, 0, sizeof(struct sockaddr_in));
sockname.sin_family = AF_INET;
sockname.sin_port = htons(SSDP_PORT);
+#if 0
/* NOTE: Binding a socket to a UDP multicast address means, that we just want
* to receive datagramms send to this multicast address.
* To specify the local nics we want to use we have to use setsockopt,
--- orig/symbolicatecrash 2015-11-12 01:00:25.000000000 +0100
+++ new/symbolicatecrash 2016-02-09 11:12:09.000000000 +0100
@@ -238,7 +238,7 @@
}
#Find any naked executables
- $cmd = "mdfind \"kMDItemContentType == public.unix-executable && kMDItemDisplayName == '$exec_name'\"";
+ $cmd = "mdfind \"( kMDItemContentType == public.unix-executable || kMDItemContentType == public.data ) && ( kMDItemDisplayName == '$exec_name' )\"";
print STDERR "Running $cmd\n" if $opt{v};
body {
background: #fff!important;
}
#jenkins-head-icon {
display: none;
}
#header .logo {
float: left;
import hudson.matrix.MatrixRun
import hudson.matrix.MatrixBuild
for (i in Jenkins.instance.items) {
i.builds.findAll {it.result && (it.result != Result.SUCCESS) && (it.result != Result.UNSTABLE)}.each {
println(it)
println(it.result)
if (it instanceof MatrixBuild) {
MatrixBuild matrixRun = it
for (j in matrixRun.getExactRuns()) {
# adding remote
git remote add module git@github.com:user/module.git
# updating remote
git fetch module
# updating remote (tag)
git fetch Weaver 0.9.9
# adding subtree (master)