Skip to content

Instantly share code, notes, and snippets.

Avatar

Nikolai Zujev jaymecd

View GitHub Profile
@jaymecd
jaymecd / remove_arg.sh
Created Feb 13, 2014
Remove bash argument
View remove_arg.sh
#!/usr/bin/env bash
#
# Remove any argument matching --env= and prepend --env=test
#
args=("$@")
idx=0
View satis_github_auth.sh
# Create a new Token
curl -u 'githubuser' -d '{"note":"Your Application"}' https://api.github.com/authorizations
# It is: "ebab4dc37e654bb230a9c69ebcd5f38e9a81e210"
#{
# "created_at": "2013-01-04T18:00:28Z",
# "app": {
# "url": "http://developer.github.com/v3/oauth/#oauth-authorizations-api",
View server_monitoring
# Cronjob for poor man monitoring of server health
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Every sunday, check for apt-get upgrades.
33 3 * * 0 root apt-get update ; apt-get -q --simulate upgrade
# Every sunday, check for SMART errors.
34 3 * * 0 root echo 'SMART Sectors'; smartctl -a /dev/sda | grep -i sector ; smartctl -a /dev/sdb | grep -i sector; echo 'SMART All'; smartctl -a /dev/sda ; smartctl -a /dev/sdb
View scrutinizer.sh
mkdir scrutinizer && cd scrutinizer
# Install tools
# - Scrutinizer and composer
wget http://scrutinizer-ci.com/scrutinizer.phar
curl -sS https://getcomposer.org/installer | php
# - All needed CI tools
php composer.phar require h4cc/phpqatools:~1.2
cp -p composer.phar vendor/bin/composer
View Document.php
<?php
use Doctrine\ODM\MongoDB\Mapping\Annotations as Mongo;
/** @Mongo\Document(collection="documents") */
class Document
{
/** @Mongo\Id */
public $id;
View ContentAwareImage.php
<?php
/**
* ContentAwareImage
*
* @author stig
*/
class ContentAwareImage {
protected static $start_time = 0.0;
View ImageType.php
<?php
class ImageType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
if ($options['required_auto'] && ! $options['required']) {
$builder->addEventListener(\Symfony\Component\Form\FormEvents::PRE_SET_DATA, array($this, 'determineRequired'));
}
View satis_install.sh
# Install a Webserver
apt-get -y install apache2
# Target docroot to /home/satis/web/
# Install PHP5 CLI and needed programs.
apt-get -y install php5-cli php5-curl php5-json git wget
# Add a specifix user for our task
adduser satis
View git_tag_cleanup.rb
# Script to delete all but a specified list of tags
# from a git repo, both locally and remotely
# Run like `mode=test ruby git_tag_cleanup` to test;
# use 'execute' mode to actually delete the tags
mode = ENV['mode'] || 'test'
tags_to_keep = %w[v2.0.0 v2.0.1]
tags_to_delete = `git tag`.split("\n") - tags_to_keep
View hubot.conf
# hubot
description "Hubot Campfire bot"
author "David Wittman <david@wittman.com>"
start on filesystem or runlevel [2345]
stop on runlevel [!2345]
# Path to Hubot installation
env HUBOT_DIR='/opt/hubot/'
You can’t perform that action at this time.