Skip to content

Instantly share code, notes, and snippets.

View samueljon's full-sized avatar

Samúel Jón Gunnarsson samueljon

View GitHub Profile
@petemcw
petemcw / default.vcl
Created May 22, 2011 02:20
Lullabot's Custom Varnish VCL File
#
# Customized VCL file for serving up a Drupal site with multiple back-ends.
#
# For more information on this VCL, visit the Lullabot article:
# http://www.lullabot.com/articles/varnish-multiple-web-servers-drupal
#
# Define the internal network subnet.
# These are used below to allow internal access to certain files while not
# allowing access from the public internet.
@saetia
saetia / gist:1623487
Last active May 1, 2024 19:55
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
@mynameispj
mynameispj / node.tpl.php
Created April 5, 2012 19:45
Drupal 7 - $messages in node.tpl.php
global $global_messages;
print $global_messages;
@tiernano
tiernano / gist:4344701
Created December 20, 2012 11:08
IPv6 Firewall rules for a MikroTik router to allow outgoing connections, but block incoming, unless they are responses...
/ipv6 firewall filter
add action=accept chain=input comment="Allow established connections" connection-state=established disabled=no
add action=accept chain=input comment="Allow related connections" connection-state=related disabled=no
add action=accept chain=input comment="Allow limited ICMP" disabled=no limit=50/5s,5 protocol=icmpv6
add action=accept chain=input comment="Allow UDP" disabled=no protocol=udp
add action=drop chain=input comment="" disabled=no
add action=accept chain=forward comment="Allow any to internet" disabled=no out-interface=sit1
add action=accept chain=forward comment="Allow established connections" connection-state=established disabled=no
add action=accept chain=forward comment="Allow related connections" connection-state=related disabled=no
add action=drop chain=forward comment="" disabled=no
@techniq
techniq / audit_mixin.py
Created March 16, 2013 01:05
Useful SQLAlchemy Mixins
from datetime import datetime
from sqlalchemy import Column, Integer, DateTime, ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declared_attr
from flask_security import current_user
class AuditMixin(object):
created_at = Column(DateTime, default=datetime.now)
updated_at = Column(DateTime, default=datetime.now, onupdate=datetime.now)
@plentz
plentz / nginx.conf
Last active April 24, 2024 11:15
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
WAN addr: 81.167.4.214
eth0 = LAN
$ ipv6calc --action 6rd_local_prefix --6rd_prefix 2a01:79c::/30 --6rd_relay_prefix 213.167.115.92/0 81.167.4.214
2a01:79d:469c:1358::/62
sudo ip tunnel add 6rdtun mode sit local 81.167.4.214 ttl 64
sudo ip tunnel 6rd dev 6rdtun 6rd-prefix 2a01:79c::/30
sudo ip link set 6rdtun up
@johnkary
johnkary / Request.php
Created December 4, 2013 03:59
Example of how to request raw XML via a SoapClient
<?php
use Psr\Log\LoggerInterface;
/**
* Assembles and dispatches the SOAP request body XML and returns the
* Response body XML from the vendor API.
*/
class Request
{
@typhonius
typhonius / seed_derivatives.drush.inc
Last active January 27, 2021 10:01
This script can generate image derivatives for Drupal for warming up the filesystem prior to going live. Image derivative generation puts an amount of load on the servers so it images have been migrated from another server with no derivatives, it may be useful to pre-generate using this script.
<?php
/**
* Implements hook_drush_command().
*/
function seed_derivatives_drush_command() {
$items = array();
$items['seed_derivatives'] = array(
'description' => "Create image derivatives",
@staltz
staltz / introrx.md
Last active May 6, 2024 01:44
The introduction to Reactive Programming you've been missing