Skip to content

Instantly share code, notes, and snippets.

View Freeaqingme's full-sized avatar
💭
Hello? Is this thing on?

Dolf Schimmel Freeaqingme

💭
Hello? Is this thing on?
View GitHub Profile
nirv@2001:19f0:1619:c9::c805:4072
<caterwaul> in fail2ban, how do I block all of Russia and China in the iptables?
<Freeaqingme> hi
<Freeaqingme> do I know you?
<caterwaul> uhhhhh
<caterwaul> you're the same species as me living on the same planet
<caterwaul> you're more closely related to me than to any other animal on this planet
<caterwaul> just call me brother.
<Freeaqingme> okay. I see.
@Freeaqingme
Freeaqingme / gist:5501135
Created May 2, 2013 09:19
Centos, or Ubuntu?
dolf@dolf-ThinkPad-T530{~/Projects/Centos}:vagrant box add CentOS6.2 http://packages.vstone.eu/vagrant-boxes/centos/6.2/centos-6.2-64bit-puppet-vbox.4.1.18.box
[vagrant] Downloading with Vagrant::Downloaders::HTTP...
[vagrant] Downloading box: http://packages.vstone.eu/vagrant-boxes/centos/6.2/centos-6.2-64bit-puppet-vbox.4.1.18.box
[vagrant] Extracting box...
[vagrant] Verifying box...
[vagrant] Cleaning up downloaded box...
dolf@dolf-ThinkPad-T530{~/Projects/Centos}:vagrant init
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
@Freeaqingme
Freeaqingme / gist:5284846
Created April 1, 2013 13:08
My puppet ENC
#!/usr/bin/env ruby
require 'yaml'
hostname = ARGV[0]
yamlOut = { 'classes' => {}, 'parameters' => {} }
if hostname[-15..-1] == '.dev.enrise.net'
yamlOut['parameters']['zone'] = 'dev'
Error: Error: /Stage[main]/Cluster::Core::Puppetmaster::Pupppet/File[/etc/puppet/hiera.yaml]: Could not evaluate: Could not retrieve information from environment production source(s) puppet:///prod-cluster/core/puppetmaster/hiera.yaml
Manifest:
---
file { '/etc/puppet/hiera.yaml':
owner => puppet,
group => puppet,
mode => 440,
source => "puppet:///prod-cluster/core/puppetmaster/hiera.yaml"
}
<?php
namespace Houdini\Guard;
use Zend\Mvc\MvcEvent;
class Route extends \BjyAuthorize\Guard\Route
{
@Freeaqingme
Freeaqingme / gist:5179181
Created March 17, 2013 01:40
Generate sitemap with #ZF2
<?php
$sm = $e->getApplication()->getServiceManager();
$routes = $sm->get('config')['router']['routes'];
echo '<ul>' . $this->parseRoutes($routes) . '</ul>';
protected function parseRoutes($routes, $names = array(), $url = array())
{
echo '<ul>';
create temporary table tmpBrands (
`id` int(10) unsigned NOT NULL,
`code` varchar(10) NOT NULL DEFAULT '',
new_id int(10) unsigned NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8;
insert into tmpBrands
SELECT b.id, b.code, (
SELECT b1.id
; ERROR 1093 (HY000) at line 14: You can't specify target table 'brands' for update in FROM clause
UPDATE accounts a LEFT JOIN brands b on b.id = a.brand_id set brand_id = (
SELECT b1.id
FROM brands b1 LEFT OUTER JOIN brands b2
ON (
b1.code = b2.code AND b1.id > b2.id)
where b2.id is null and UPPER(b1.code) = UPPER(b.code)
)
SELECT b1.id, b1.code
FROM brands b1 LEFT OUTER JOIN brands b2
ON (b1.code = b2.code AND b1.id > b2.id)
where b2.id is null
select a.*, (
SELECT b1.id
FROM brands b1 LEFT OUTER JOIN brands b2
@Freeaqingme
Freeaqingme / gist:5116149
Created March 8, 2013 12:28
My virtual host
<Virtualhost *:80>
VirtualDocumentRoot "/home/dolf/Projects/vhosts/%1/public"
ServerName vhosts.dev
ServerAlias *.dev
UseCanonicalName Off
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
ErrorLog "/var/log/apache2/vhosts-error_log"
<Directory "/home/dolf/Projects/*">