Skip to content

Instantly share code, notes, and snippets.

View dmuth's full-sized avatar
💭
White Mage

Douglas Muth dmuth

💭
White Mage
View GitHub Profile
<?php
/**
* This code is to load a chat created with Drupal's Chat Room module
* (http://drupal.org/project/chatroom) into a block.
* If implemented properly, users will be able to chat from any page
* on the site that displays this block.
*
* @author Douglas Muth <http://www.dmuth.org/>
*/
@dmuth
dmuth / gist:1587034
Created January 10, 2012 04:52
How to secure a Drupal site
<?php
/**
*
* From my blog post at:
*
* http://www.dmuth.org/node/1202/how-secure-drupal-site
*
*/
$path = getenv("SCRIPT_URL");
@dmuth
dmuth / gist:1587038
Created January 10, 2012 04:54
Drupal shows "create content" menu item to anonymous users
<?php
/**
* From my blog post at:
*
* http://www.dmuth.org/node/1201/drupal-shows-create-content-menu-item-anonymous-users
*
*/
if (strstr($_SERVER["REQUEST_URI"], "/node/add")) {
[dolph:~ ] $ curl -v http://64.121.64.153:8000/stream/1/
* About to connect() to 64.121.64.153 port 8000 (#0)
* Trying 64.121.64.153... connected
> GET /stream/1/ HTTP/1.1
> User-Agent: curl/7.22.0 (x86_64-apple-darwin10.7.0) libcurl/7.22.0 OpenSSL/1.0.1c zlib/1.2.7 libidn/1.22
> Host: 64.121.64.153:8000
> Accept: */*
>
ICY 401 Service Unavailable
icy-notice1:<BR>SHOUTcast Distributed Network Audio Server/win64 v2.0.0.29<BR>
@dmuth
dmuth / gist:5695205
Created June 2, 2013 22:38
/etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp
@dmuth
dmuth / gist:8165763
Created December 28, 2013 23:52
Some changes I made to the script found at http://jonathan-kim.com/2013/gmail-no-response Specifically: I added the ignoreThisSubject() and threadHasIgnoreLabel() functions.
/*
* This script goes through your Gmail Inbox and finds recent emails where you
* were the last respondent. It applies a nice label to them, so you can
* see them in Priority Inbox or do something else.
*
* To remove and ignore an email thread, just remove the unrespondedLabel and
* apply the ignoreLabel.
*
* This is most effective when paired with a time-based script trigger.
*
@dmuth
dmuth / DeleteGmailBulk.js
Last active February 17, 2016 20:00
Delete threads from your Gmail mailbox in bulk Raw
//
// Paste this function into the window at http://script.google.com/ and
// then click the triangle button in the menu bar to run it.
//
// After the script is finished running (which can take a minute or longer!),
// go to View -> Logs to view the logs of the script execution.
//
// Based off of a script I found at https://productforums.google.com/forum/#!topic/gmail/YeQVDuPIQzA
//
#!/usr/bin/env php
<?php
/**
* This script solves the problem posted at https://www.facebook.com/hserus/posts/10209365831889209
*
* If you choose an answer to this question at random, what is the chance you will be correct?
*
* A) 25%
* B) 50%
* C) 60%
@dmuth
dmuth / s3-undelete.sh
Created December 11, 2016 21:40
Script to undelete files from Amazon S3
#!/bin/bash
#
# This script can be used to undelete objects from an S3 bucket.
# When run, it will print out a list of AWS commands to undelete files, which you
# can then pipe into Bash.
#
# e.g.: s3-undelete.sh <options> > files.txt; cat files.txt | bash
#
# You will need the AWS CLI tool from https://aws.amazon.com/cli/ in order to run this script.
#

Keybase proof

I hereby claim:

  • I am dmuth on github.
  • I am dmuth (https://keybase.io/dmuth) on keybase.
  • I have a public key ASA3KPZ_mYWvzsYrN2KCqpRjY30CPUy1ZCuc_3CWhB1yIwo

To claim this, I am signing this object: