Skip to content

Instantly share code, notes, and snippets.

Avatar

Ole Fredrik Skudsvik olesku

View GitHub Profile
View gist:1f843065f74af860df510acb1bd08e27
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netdb.h>
#include <string.h>
#define BUFSIZE 1024
View gist:4b02a3b38523220f1c07d15edb8032d5
[vagrant@agent-01 ~]$ curl http://whalesay.marathon.mesos
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>nikovirtala/whalesay</title>
</head>
<body>
<pre>
## .
View tomcat.pl
#!/usr/bin/perl
my @tomcatInitScriptPaths = ( "/etc/init.d/tomcat", "/etc/init.d/tomcat6" );
# Do not change from here.
my $tomcatInitScript;
foreach (@tomcatInitScriptPaths) { $tomcatInitScript = $_ if ( -e $_ ); }
die("Error: Could not find Tomcat init script.\n") unless($tomcatInitScript);
View gist:fcf63abf645f4d7213b12334b72b6e82
### Keybase proof
I hereby claim:
* I am olesku on github.
* I am olesku (https://keybase.io/olesku) on keybase.
* I have a public key whose fingerprint is 6556 81A2 6ECC 01E6 02E4 9C34 0A80 345F 2027 BCF9
To claim this, I am signing this object:
@olesku
olesku / count_missing_ssl_hdr.pl
Created Jan 30, 2015
Count missing X-Forwarded-Proto irule on SSL VIPS.
View count_missing_ssl_hdr.pl
#!/usr/bin/perl
my $inblock = 0, $curhost = "", $curname = "";
open(BIGIP, "bigip.conf") or die("Could not open config file.\n");
while (<BIGIP>) {
$curname = $1 if (m/ltm\s+virtual\s+(.+)\s+{$/);
$inblock = 1, $curhost = $1 if (m/destination\s+(.+\:443)$/);
if (m/^}$/ && $inblock) {
View sublimeRemoteEdit.py
import sublime, sublime_plugin, os
class ScpOnSave(sublime_plugin.EventListener):
def on_post_save(self, view):
remoteFolders = [
[ "/home/oles/Code/project", "oles@skudsvik.no:~/www/project" ]
]
fileName = view.file_name()
@olesku
olesku / gist:6387821
Created Aug 30, 2013
zend_mm_heap corrupted strace
View gist:6387821
accept4(4, {sa_family=AF_INET6, sin6_port=htons(43518), inet_pton(AF_INET6, "::ffff:127.0.0.1", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, [28], SOCK_CLOEXEC) = 136
getsockname(136, {sa_family=AF_INET6, sin6_port=htons(81), inet_pton(AF_INET6, "::ffff:127.0.0.1", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, [28]) = 0
fcntl(136, F_GETFL) = 0x2 (flags O_RDWR)
fcntl(136, F_SETFL, O_RDWR|O_NONBLOCK) = 0
read(136, "GET /drpublish/external-links/cs"..., 8000) = 2281
socket(PF_NETLINK, SOCK_RAW, 0) = 137
bind(137, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 0
getsockname(137, {sa_family=AF_NETLINK, pid=29240, groups=00000000}, [12]) = 0
sendto(137, "\24\0\0\0\26\0\1\3&\17\37R\0\0\0\0\0\0\0\0", 20, 0, {sa_family=AF_NETLINK, pid=0, groups=00000000}, 12) = 20
recvmsg(137, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"0\0\0\0\24\0\2\0&\17\37R8r\0\0\2\10\200\376\1\0\0\0\10\0\1\0\177\0\0\1"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 108
@olesku
olesku / full_backtrace_zend_mm_heap_corrupted
Created Aug 29, 2013
full backtrace zend_mm_heap corrupted
View full_backtrace_zend_mm_heap_corrupted
(gdb) bt full
#0 zend_mm_add_to_free_list (heap=<value optimized out>, mm_block=0x7f8e9aef8cc0) at /usr/src/debug/php-5.4.19/Zend/zend_alloc.c:748
m = <value optimized out>
p = <value optimized out>
size = 760
index = <value optimized out>
#1 0x00007f8e8ed74412 in _zend_mm_free_int (heap=0x7f8e9a32d6a0, p=0x7f8e9aef8cd0) at /usr/src/debug/php-5.4.19/Zend/zend_alloc.c:2114
mm_block = 0x7f8e9aef8cc0
next_block = 0x7f8e9aef8d68
size = 760
@olesku
olesku / gist:6365029
Created Aug 28, 2013
zend_mm_heap corrupted reproduce script
View gist:6365029
<?php
define('OBJECT_COUNT', 20 * 1000);
class Object {
private static $world = array();
private static $maxGuid = 0;
protected $_guid = null;
public function __construct() {
self::$world[$this->_guid = self::$maxGuid++] = $this;
}
@olesku
olesku / gist:6316771
Created Aug 23, 2013
zend_mm_heap corrupted segfault
View gist:6316771
Core was generated by `/usr/sbin/httpd'.
Program terminated with signal 11, Segmentation fault.
#0 zend_mm_add_to_free_list (heap=<value optimized out>, mm_block=0x7f8e9aef8cc0) at /usr/src/debug/php-5.4.19/Zend/zend_alloc.c:748
748 if (ZEND_MM_FREE_BLOCK_SIZE(prev) != size) {
(gdb) bt
#0 zend_mm_add_to_free_list (heap=<value optimized out>, mm_block=0x7f8e9aef8cc0) at /usr/src/debug/php-5.4.19/Zend/zend_alloc.c:748
#1 0x00007f8e8ed74412 in _zend_mm_free_int (heap=0x7f8e9a32d6a0, p=0x7f8e9aef8cd0) at /usr/src/debug/php-5.4.19/Zend/zend_alloc.c:2114
#2 0x00007f8e8eda6ad1 in zend_hash_destroy (ht=0x7f8e8f19ffd0) at /usr/src/debug/php-5.4.19/Zend/zend_hash.c:565
#3 0x00007f8e8ed8d173 in shutdown_executor () at /usr/src/debug/php-5.4.19/Zend/zend_execute_API.c:322
#4 0x00007f8e8ed99e52 in zend_deactivate () at /usr/src/debug/php-5.4.19/Zend/zend.c:938