Skip to content

Instantly share code, notes, and snippets.

Stig Lindqvist stojg

View GitHub Profile
@stojg
stojg / rm-corrupt.sh
Last active Oct 4, 2016 — forked from codepunkt/rm-corrupt.sh
find/delete corrupt whisper-files
View rm-corrupt.sh
#!/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;;
View bgd-php.template
{
"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]*",
View mysite_code_MemberAutocompleteField.php
<?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");
View FindIncorrectLinksTask.php
<?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';
View 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:

View 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"
View setup-percona-server.sh
#!/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 / ss-upgrade.sh
Created Nov 8, 2012 — forked from phptek/ss-upgrade.sh
Search and replace for SS 3.0 upgrade [beta]
View ss-upgrade.sh
#!/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.
You can’t perform that action at this time.