Skip to content

Instantly share code, notes, and snippets.

View samueljon's full-sized avatar

Samúel Jón Gunnarsson samueljon

View GitHub Profile
@samueljon
samueljon / my_bootstrap.info
Last active August 29, 2015 14:18
How to write an Drupal 7 installation profile - https://www.drupal.org/node/1022020
name = My Bootstrap Profile
description = Description of what the profile does.
core = 7.x
; Optional: Mark your installation profile as exclusive, so that the installer
; will auto-select it.
exclusive = true
dependencies[] = block
dependencies[] = color
dependencies[] = comment
@samueljon
samueljon / my_bootstrap.install
Last active August 29, 2015 14:18
Creating Drupal 7 installation profile https://www.drupal.org/node/1022020
<?php
/**
* Implement hook_install().
*
* Perform actions to set up the site for this profile.
*/
function my_bootstrap_install() {
include_once DRUPAL_ROOT . '/profiles/minimal/minimal.install';
minimal_install();
@samueljon
samueljon / my_bootstrap.make
Last active August 29, 2015 14:18
Drush make example
; My Boostrap makefile
core = 7.x
api = 2
projects[] = drupal
projects[my_bootstrap_profile][type] = profile
projects[my_bootstrap_profile][download][type] = git
projects[my_bootstrap_profile][download][url] = "https://github.com/username/my_bootstrap_profile.git"
projects[my_bootstrap_profile][download][branch] = master
class LsRetailVariant extends LsRetailVorurMigration {
private function getVariantType($fieldName){
switch($fieldName){
//Afbrigði
case 'AFBRIGÐI':
return 'field_nav_afbrigdi';
break;
//Litur
case 'COLOR':
class LsRetailProduct extends LsRetailVorurMigration {
public function __construct($arguments) {
parent::__construct($arguments);
$this->description = t('Import products from LS Retail.');
$this->dependencies = array(
'LsRetailCategoriesTop',
'LsRetailCategoriesSecond',
'LsRetailCategoriesThird',
);
@samueljon
samueljon / gist:d96e9e741686a5f13488
Last active March 9, 2016 22:46 — forked from tiernano/gist:4344701
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 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
nginx:
image: samueljon/docker-nginx-drupal:develop
ports:
- "8000:80"
- "4430:443"
links:
- db
- php
volumes:
- webroot:/webroot
@samueljon
samueljon / foreachloop.php
Last active May 24, 2016 23:10
example for a friend
<html>
<body>
<?php
$rows = array(
'0' => array( 'name' => 'Herbert', 'phone' => '4312244'),
'1' => array( 'name' => 'Herbert2', 'phone' => '4312266'),
);
?>
<!-- Table -->
<php if(!empty($rows) : ?>
@samueljon
samueljon / toggleHT.sh
Last active January 9, 2025 12:55
Disable / Enable HyperThreading cores on runtime - linux
#!/bin/bash
HYPERTHREADING=1
function toggleHyperThreading() {
for CPU in /sys/devices/system/cpu/cpu[0-9]*; do
CPUID=`basename $CPU | cut -b4-`
echo -en "CPU: $CPUID\t"
[ -e $CPU/online ] && echo "1" > $CPU/online
THREAD1=`cat $CPU/topology/thread_siblings_list | cut -f1 -d,`

Keybase proof

I hereby claim:

  • I am samueljon on github.
  • I am samueljon (https://keybase.io/samueljon) on keybase.
  • I have a public key whose fingerprint is BDBD 4772 41E8 D22A 0F00 61C7 0564 BCB7 8181 7004

To claim this, I am signing this object: