Skip to content

Instantly share code, notes, and snippets.

@sorin-ionescu
sorin-ionescu / minidlna.1.1.1.kqueue.freebsd.patch
Created January 23, 2014 01:49
MiniDLNA 1.1.1 kqueue patch
diff --git a/configure.ac b/configure.ac
index 9ba8fac..4fa72a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -437,7 +437,7 @@ AC_CHECK_LIB(vorbisfile, vorbis_comment_query,
################################################################################################################
### Header checks
-AC_CHECK_HEADERS([arpa/inet.h asm/unistd.h endian.h machine/endian.h fcntl.h libintl.h locale.h netdb.h netinet/in.h stddef.h stdlib.h string.h sys/file.h sys/inotify.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h unistd.h])
+AC_CHECK_HEADERS([arpa/inet.h asm/unistd.h endian.h machine/endian.h fcntl.h libintl.h locale.h netdb.h netinet/in.h stddef.h stdlib.h string.h sys/file.h sys/inotify.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h unistd.h sys/event.h])
@sorin-ionescu
sorin-ionescu / fsevents.patch
Last active July 9, 2020 17:53
MiniDLNA v1.1.4 patches for Mac OS X.
diff --git 1/configure.ac 2/configure.ac
index 3a8a54c..17c2108 100644
--- 1/configure.ac
+++ 2/configure.ac
@@ -505,6 +505,12 @@ AC_CHECK_FUNCS(inotify_init, AC_DEFINE(HAVE_INOTIFY,1,[Whether kernel has inotif
])
])
+AC_CHECK_HEADERS([CoreFoundation/CoreFoundation.h], [
+ CFLAGS="$CFLAGS -I /System/Library/Frameworks/CoreFoundation.framework/Headers"
@sorin-ionescu
sorin-ionescu / safari_reading_list_to_read_later_service.py
Last active March 14, 2019 08:50
Imports the Safari Reading List into read later services such as Instapaper, Readability, and Pocket.
#!/usr/bin/env python
# encoding: utf-8
#
# safari_reading_list_to_read_later_service.py
#
# Imports the Safari Reading List into read later services such as Instapaper,
# Readability, and Pocket.
#
# (The MIT License)
@sorin-ionescu
sorin-ionescu / make-hubugs.sh
Last active October 2, 2015 02:38
Make a self contained hubugs
#!/bin/zsh
if (( ! $+commands[virtualenv] )); then
print "$0: no such command: virtualenv" >&2
return 1
fi
if (( ! $+commands[git] )); then
print "$0: no such command: git" >&2
return 1
@sorin-ionescu
sorin-ionescu / objective-c.js
Created February 25, 2012 01:42
Solving the JavaScript inheritance clusterfuck.
var console = require('console');
/**
* The Problem:
*
* JavaScript librariers have developed many inheritance helpers,
* often classical, to avoid using the horrible Netscape Java
* marketer syntax to set up object inheritance chains.
*
* Prototypical inheritance should be dead simple, not convoluted.
@sorin-ionescu
sorin-ionescu / deescalation.rb
Created March 1, 2011 02:41
Ruby privilege de-escalation.
if ENV['USER'] == 'root'
puts "uid: #{Process::UID.rid} euid: #{Process::UID.eid} gid: #{Process::GID.rid} egid: #{Process::GID.eid}"
fork do
begin
uid, gid = Process.euid, Process.egid
target_uid, target_gid = ENV['SUDO_UID'].to_i, ENV['SUDO_GID'].to_i
if uid != target_uid or gid != target_gid
Process.initgroups(ENV['SUDO_USER'], target_gid)
Process::GID.change_privilege(target_gid)
Process::UID.change_privilege(target_uid)