Skip to content

Instantly share code, notes, and snippets.

View christianhager's full-sized avatar

Christian Hager christianhager

View GitHub Profile
@christianhager
christianhager / gist:888681
Created March 26, 2011 22:07
sudo iptables -L output
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere
REJECT all -- anywhere 127.0.0.0/8 reject-with icmp-port-unreachable
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT tcp -- anywhere anywhere tcp dpt:www
ACCEPT tcp -- anywhere anywhere tcp dpt:https
ACCEPT tcp -- anywhere anywhere tcp dpt:8003
ACCEPT tcp -- anywhere anywhere tcp dpt:6789
ACCEPT tcp -- anywhere anywhere tcp dpt:8400
@christianhager
christianhager / cron fail
Created March 24, 2011 05:44
cron stopped and won't start
+ [[ '' != \y\e\s ]]
+ source /sbin/functions.sh
++ RC_GOT_FUNCTIONS=yes
++ [[ -f /etc/conf.d/rc ]]
++ source /etc/conf.d/rc
+++ RC_TTY_NUMBER=11
+++ RC_PARALLEL_STARTUP=no
+++ RC_INTERACTIVE=yes
+++ RC_HOTPLUG=yes
+++ RC_COLDPLUG=yes
@christianhager
christianhager / gist:731296
Created December 7, 2010 01:02
sudo iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere
REJECT all -- anywhere 127.0.0.0/8 reject-with icmp-port-unreachable
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT tcp -- anywhere anywhere tcp dpt:www
ACCEPT tcp -- anywhere anywhere tcp dpt:https
ACCEPT tcp -- anywhere anywhere tcp dpt:8003
ACCEPT tcp -- anywhere anywhere tcp dpt:8400
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:30000
@christianhager
christianhager / gist:672027
Created November 11, 2010 04:49
Toggle flere
//en av linkene blir trykket
$(".link").click(function(){
var id = $(this).attr("id"); // henter ut riktig id
showThisBox(id); // vi kaller på funksjonen som viser en, gjemmer de andre
return false; //for å unngå at man hopper i skjermen
});
//vis en, gjem de andre
function showThisBox(id){
//looper alle boksene
#
# Forecasts klare til å rapporteres, vi tenker oss at klokken er 10 i dag
# De første 24 verdiene kommer fra DayReport => forecast
# De neste kommer fra DayReport => long_forecast
# Total 168 verdier: 24 + 24*6
# Den første verdien er i morgen 26 august kl 00:00:00
#
[
#Embedded vs link
#I'm looking for the fastest way to search a Newsletter document for a connected Email. So far I have used
#MongoMapper with one document for Newsletter and another for Email. This is getting really slow with +100k
#Emails.
#I was thinking maybe its faster to embed the emails in an array inside Newsletter
#since I'm really only interested in the email ('someemail@email.com')
#and not any logic around it.
[Tue, 01 Jun 2010 15:37:13 -0700] INFO: Starting Chef Solo Run
[Tue, 01 Jun 2010 15:37:14 -0700] INFO: {"MANPATH"=>
"/etc/java-config-2/current-system-vm/man:/usr/local/share/man:/usr/share/man:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.18/man:/usr/share/gcc-data/x86_64-pc-linux-gnu/4.1.2/man:/etc/java-config/system-vm/man/:/usr/share/postgresql-8.3/man:/usr/lib64/erlang/man",
"SHELL"=>"/bin/bash",
"SSH_CLIENT"=>"10.208.30.159 53672 22",
"USER"=>"root",
"CONFIG_PROTECT_MASK"=>
"/etc/env.d/java/ /etc/udev/rules.d /etc/fonts/fonts.conf /etc/terminfo /etc/eselect/postgresql /etc/ca-certificates.conf /etc/revdep-rebuild",
top - 03:08:28 up 19 days, 8:26, 1 user, load average: 0.00, 0.01, 0.00
Tasks: 54 total, 2 running, 52 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.0%sy, 0.0%ni, 99.8%id, 0.0%wa, 0.0%hi, 0.0%si, 0.2%st
Mem: 7864460k total, 6633188k used, 1231272k free, 531672k buffers
Swap: 31463260k total, 84k used, 31463176k free, 1312924k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
15354 mysql 15 0 2934m 2.7g 5076 S 0 35.7 46:48.13 mysqld
13755 christph 15 0 765m 647m 5344 S 0 8.4 258:20.39 ruby
11903 christph 15 0 232m 111m 3116 S 0
namespace :db do
namespace :test do
task :prepare do
# Stub out for MongoDB
end
end
end
ENV["RAILS_ENV"] ||= "test"
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support
require 'cucumber/rails/rspec'
require 'cucumber/rails/world'
#require 'cucumber/rails/active_record'
require 'cucumber/web/tableish'