Skip to content

Instantly share code, notes, and snippets.

View stojg's full-sized avatar

Stig Lindqvist stojg

View GitHub Profile
@stojg
stojg / ss-upgrade.sh
Created November 8, 2012 00:21 — forked from phptek/ss-upgrade.sh
Search and replace for SS 3.0 upgrade [beta]
#!/bin/bash
#
# ss-upgrader.sh
#
# INTRODUCTION
#
# There are some threads on the SS forums that describe the techdocs for upgrading a 2.4 site to 3.x as being too technical. Mainly from content authors who
# also happen to be site maintainers - they are not coders.
# The aim of this script is to therefore to automate - in as much as this is possible in a user-configured, open-source software project - to help those new to
# SS3 upgrade from 2.x as smoothly as possible.
#!/bin/sh
############################
# Author: Till Klampaeckel #
# License: New BSD License #
############################
version=$1
if [ "x$version" = "x" ]; then
echo "Usage: ./$0 5.0|5.1"
@stojg
stojg / bench.sh
Created March 14, 2013 00:32 — forked from chillu/bench.sh
#/bin/bash
# Compares response times on a specific URL on different SilverStripe versions.
#
# USAGE: bench.sh <base-path> <base-url>
basepath=$1
baseurl=$2
urls="/?flush=all /"
abparams="-n 10"
@stojg
stojg / pr.md
Created April 16, 2013 22:23 — forked from piscisaureus/pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

<?php
/**
* A task to identify any pages on the site that are referencing absolute URLs
* (that is, URLs like http://site.com, instead of [sitetree])
* Can't easily be automated due to https://github.com/silverstripe/silverstripe-cms/issues/812
*/
class FindIncorrectLinksTask extends BuildTask {
protected $title = 'Find Incorrect Links Tasks';
<?php
class MemberAutocompleteField extends TextField {
private static $allowed_actions = array('suggest');
public $maxSuggestionsNum = 50;
public function Field($properties = array()) {
Requirements::javascript("mysite/javascript/MemberAutocompleteField.js");
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "PHP Blue-Green Deployment environment template",
"Parameters" : {
"KeyName" : {
"Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instances",
"Type" : "String",
"MinLength" : "1",
"MaxLength" : "64",
"AllowedPattern" : "[-_ a-zA-Z0-9]*",
@stojg
stojg / rm-corrupt.sh
Last active October 4, 2016 05:27 — forked from codepunkt/rm-corrupt.sh
find/delete corrupt whisper-files
#!/bin/bash
options=('find' 'delete')
PS3='state your wish: '
echo -e "\nfind/delete corrupt whisper-files"
select opt in "${options[@]}"; do
case $REPLY in
[12] ) option=$opt; break;;
* ) exit;;
@stojg
stojg / postgres_queries_and_commands.sql
Created April 28, 2021 01:28 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@stojg
stojg / server-name-wordlist-mnemonic.txt
Created September 6, 2022 23:12 — forked from bwbaugh/server-name-wordlist-mnemonic.txt
Server name wordlist (mnemonic)
# Original blog post: <https://mnx.io/blog/a-proper-server-naming-scheme/>
# Original word list: <http://web.archive.org/web/20091003023412/http://tothink.com/mnemonic/wordlist.txt>
# Sample usage: `curl <gist> | tail --lines +4 | shuf | head --lines 1`
acrobat
africa
alaska
albert
albino
album
alcohol