Skip to content

Instantly share code, notes, and snippets.

View mistermarco's full-sized avatar

Marco Wise mistermarco

  • Stanford University
View GitHub Profile
@mistermarco
mistermarco / psa-2016-001.sh
Created July 12, 2016 23:49
Compares Drupal modules on your site with those that report being used between 1,000 to 10,000 times on Drupal.org
# create a set of links for the Drupal project page usage from page 5 to 22 (the ones containing modules
# that are installed on 1,000-10,000 websites
# See https://www.drupal.org/node/2764899
# Drupal contrib - Highly Critical - Remote code execution PSA-2016-001
seq -f "https://www.drupal.org/project/usage?page=%02g" 5 22 >> urls.txt
# Download the content from all the pages
wget -i urls.txt
# get a count of all items in Drupal's custom menus
select mc.title, count(mc.menu_name) from menu_custom as mc left join menu_links as ml using(menu_name) where ml.hidden = 0 group by mc.title order by mc.title;
@mistermarco
mistermarco / gist:6939132
Created October 11, 2013 17:52
This block lists all the rest of the posts in a page's first category.
{% comment %}
This block lists all the rest of the posts in a page's first category.
{% endcomment %}
{% assign first_category_name = page.categories.first %}
{% for category in site.categories %}
{% if category.first == first_category_name %}
{% assign first_category_posts = category[1] %}
{% endif %}
{% endfor %}
@mistermarco
mistermarco / getting_started.sh
Created October 11, 2013 05:11
Getting started with the blog
git clone git@github.com:mistermarco/mistermarco.github.io.git
cd _posts
vi 2013-11-03-new-post.markdown
jekyll serve --watch
@mistermarco
mistermarco / table_class.js
Created October 11, 2013 01:21
Add the table class to tables (Bootstrap3)
$("table").addClass('table');
@mistermarco
mistermarco / pwgen.pl
Created December 6, 2012 23:54
Generate Passwords
#! /usr/bin/perl
use Getopt::Std;
sub HELP_MESSAGE() {
my $fh = shift;
printf $fh <<END_HELP;
Usage: $0 \[-c\] \[-n\] \[-y\] \[length\]
Create a password length characters long; length defaults to 8
@mistermarco
mistermarco / sites.test.php
Created July 25, 2012 08:17
Sites/People test
<pre>
<?php
$site_name = exec('whoami');
echo "Starting Testing...\n";
echo 'Running as ' . $site_name . "\n";
echo 'Server that responded: ' . exec('uname -a') . "\n\n";
@mistermarco
mistermarco / page_count.pl
Created November 30, 2011 20:37
Count "pages" in a file, given a template size and an estimated number of characters per page.
#!/usr/bin/perl
use File::Find;
use Getopt::Long;
use Pod::Usage;
use Term::ANSIColor;
use strict;
my $default_overhead_size = 2000;
my $default_page_size = 2500;
@mistermarco
mistermarco / random.pl
Created October 21, 2011 05:29
Create random password
#! /usr/bin/perl
# ./pwgen -c 64 | pbcopy
use Getopt::Std;
sub HELP_MESSAGE() {
my $fh = shift;
printf $fh <<END_HELP;
Usage: $0 \[-c\] \[-n\] \[-y\] \[length\]
@mistermarco
mistermarco / Git Tags
Created October 3, 2011 23:17
Create git tags / automatic download
# this creates a tag, which creates a download package on the downloads page
git tag -a v3.x-beta2
git push --tags origin