Skip to content

Instantly share code, notes, and snippets.

@Dakta
Dakta / README.md
Last active August 30, 2018 23:04
Enable mdns on a FreeNAS/BSD jail.

Usage

Simple:

# inside a jail!
$ wget <link to mdns.sh RAW from gist e.g https://gist.githubusercontent.com/Dakta/d37f038e90bcc68822efdc5b6d38985c/raw/36da05f072982e5836a03f0ca556f3c28a6cb1e2/mdns.sh>
$ chmod +x mdns.sh
$ ./mdns.sh
@Dakta
Dakta / gist:4449513
Created January 4, 2013 02:52
Reddit inline images bookmarklet. Good for iOS devices where you can't get RES.
javascript:%20(function%20()%20%7B%20%20%20%20%20var%20things%20=%20document.querySelectorAll(%22div.thing%22);%20%20%20%20%20for%20(var%20j%20=%200;%20j%20%3C%20things.length;%20j++)%20%7B%20%20%20%20%20%20%20%20%20var%20thing%20=%20things%5Bj%5D,%20%20%20%20%20%20%20%20%20%20%20%20%20entry%20=%20thing.querySelectorAll(%22div.entry%22)%5B0%5D,%20%20%20%20%20%20%20%20%20%20%20%20%20thumb%20=%20thing.querySelectorAll(%22a.thumbnail%22)%5B0%5D,%20%20%20%20%20%20%20%20%20%20%20%20%20img%20=%20new%20Image;%20%20%20%20%20%20%20%20%20img.style.display%20=%20'block';%20%20%20%20%20%20%20%20%20img.style.width%20=%20'100%25';%20%20%20%20%20%20%20%20%20if%20(thumb)%20%7B%20%20%20%20%20%20%20%20%20%20%20%20%20var%20href%20=%20thumb.href;%20%20%20%20%20%20%20%20%20%20%20%20%20if%20(/%5C.(png%7Cgif%7Cjpg)$/i.test(href))%20img.src%20=%20href;%20%20%20%20%20%20%20%20%20%20%20%20%20else%20if%20(/imgur%5C.com/i.test(href))%20%7B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20var%20id%20=%20/%5Cw+?$/.exec(href)%5B0%5D;%20%2
@Dakta
Dakta / gist:4103917
Created November 18, 2012 06:50 — forked from jsocol/gist:1568904
Bookmarklet to add inline full-size images to Reddit.
javascript: (function () {
var things = document.querySelectorAll("div.thing");
for (var j = 0; j < things.length; j++) {
var thing = things[j],
entry = thing.querySelectorAll("div.entry")[0],
thumb = thing.querySelectorAll("a.thumbnail")[0],
img = new Image;
img.style.display = 'block';
img.style.width = '100%';
if (thumb) {
@Dakta
Dakta / gist:4d5835872b3be47c8f19
Created July 28, 2015 05:10
"load more comments" vs "continue this thread"
"data": {
"modhash": "d4bz7jflyc4f25f009d120d7264e53591880ca26d333cf9c57",
"children": [
{
"kind": "t1",
"data": {
"subreddit_id": "t5_2qh1i",
"banned_by": null,
"removal_reason": null,
"link_id": "t3_3es8up",
@Dakta
Dakta / NotificationCenter
Created October 19, 2014 21:19
Activate Notification Center from AppleScript and Switch Panes
on displayNotificationCenterToday()
tell application "System Events"
click menu bar item "Notification Center" of menu bar 2 of process "SystemUIServer"
click radio button "Today" of radio group 1 of window "NotificationTableWindow" of process "NotificationCenter"
end tell
end displayNotificationCenterToday
on displayNotificationCenterNotifications()
tell application "System Events"
click menu bar item "Notification Center" of menu bar 2 of process "SystemUIServer"
function tbobject() {
Toolbox = {
utils: TBUtils,
version: '2.0.1',
modules: {},
register_module: function(module) {
this.modules[module.shortname] = module;
@Dakta
Dakta / timetools.py
Last active August 29, 2015 13:56
A couple useful functions for dealing with python timedelta and human readable representations.
def str_to_timedelta(time_str):
"""Parses a human readable time duration string into a datetime.timedelta object
Order from largest to smallest units. Numeric representation of values. Spaces
optional. Specify units with first letter or full word (plural optional).
Parses weeks, days, hours, minutes, seconds.
Examples:
-"1d5h42m33s"
-"1 day 1 hours 43 seconds" (note that hour or hours is accepted here)
@Dakta
Dakta / banlist-filter.grease.js
Last active August 29, 2015 13:56
Reddit banlist filter
// ==UserScript==
// @name reddit ban list live filter
// @version 0.2
// @namespace Dakota Schneider <dakota@hackthetruth.org>
// @include http://*.reddit.com/r/*/about/banned/
// @include http://*.reddit.com/r/*/about/banned
// @include http://reddit.com/r/*/about/banned/
// @include http://reddit.com/r/*/about/banned
// @grant none
// @run-at document-end