Skip to content

Instantly share code, notes, and snippets.

View sschueller's full-sized avatar
Working

Stefan sschueller

Working
View GitHub Profile
@ircmaxell
ircmaxell / gist:1966809
Created March 3, 2012 16:03
Scalar Casting Patch, Version 3
Index: Zend/zend.h
===================================================================
--- Zend/zend.h (revision 323850)
+++ Zend/zend.h (working copy)
@@ -486,6 +486,10 @@
union _zend_function *__call;
union _zend_function *__callstatic;
union _zend_function *__tostring;
+ union _zend_function *__toint;
+ union _zend_function *__tofloat;
@srinivasmohan
srinivasmohan / hipchat_notify.rb
Created April 19, 2012 05:32
Post Nagios alerts to Hipchat
#!/usr/bin/ruby
require 'rubygems'
require 'hipchat-api'
require 'getopt/long'
require 'socket'
require 'erb'
#Do not modify these constants! (after you set these up, of course)
HipApiKey='ABCDEFGHKJHKJHKJHKJH'
Room='Nagios'
@schubert
schubert / mixlib_log_monkey_patch.rb
Created August 9, 2012 21:43
colorize your chef solo output (put in libraries)
require "mixlib/log/formatter"
module Mixlib
module Log
class Formatter < Logger::Formatter
# Prints a log message as '[time] severity: message' if Chef::Log::Formatter.show_time == true.
# Otherwise, doesn't print the time.
def call(severity, time, progname, msg)
if @@show_time
reset = "\033[0m"
@jirutka
jirutka / rules-both.iptables
Created September 18, 2012 12:42
Basic iptables template for ordinary servers (both IPv4 and IPv6)
###############################################################################
# The MIT License
#
# Copyright 2012-2014 Jakub Jirutka <jakub@jirutka.cz>.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@nall
nall / syno_ddns_nsupdate.pl
Last active November 22, 2019 14:14
Crontab script for Synology boxes. Updaes a DNS BIND server when hostname or WAN IP changes. Requires the Synology DNSServer package to be installed (but doesn't need to be running).
#!/opt/bin/perl
use warnings;
use strict;
# Copyright (c) 2013 Jon Nall, STUNTAZ!!! All rights reserved.
#
# This script is intended to be run on a Synology NAS. It attempts
# to determine the external IP where the NAS is connected and then
# checks to see if it needs to update a DNS record. The server is
# updated if any of these are true:
@FokkeZB
FokkeZB / CROP.md
Created May 2, 2013 09:43
Image (cropping) CommonJS lib for Titanium

Often I need to display a user-provided picture in an ImageView in such a way that the whole ImageView is filled with as much of the picture possible.

This is how I do it:

var image = require('image');

Ti.Media.showCamera({
        mediaTypes: [Ti.Media.MEDIA_TYPE_PHOTO],
 success: function (e) {
@WebEndevSnippets
WebEndevSnippets / functions.php
Created October 27, 2013 15:37
WordPress: Reduce Database Queries
Reduce database queries (http://www.catswhocode.com/blog/speeding-up-your-wordpress-blog-7-effective-solutions)
It is important to reduce unecessary queries to your database as each query take a few milliseconds to execute. First, you might want to know how many queries your blog execute in order to display a page. To do so, paste the code below in your functions.php file. Once done, just have a look to your site footer to know how many queries has been executed and how many time it took to completely load the page.
add_action( 'wp_footer', 'tcb_note_server_side_page_speed' );
function tcb_note_server_side_page_speed() {
date_default_timezone_set( get_option( 'timezone_string' ) );
$content = '[ ' . date( 'Y-m-d H:i:s T' ) . ' ] ';
$content .= 'Page created in ';
$content .= timer_stop( $display = 0, $precision = 2 );
$content .= ' seconds from ';
@ricardoalcocer
ricardoalcocer / themes.md
Last active October 15, 2021 08:10
Changing Android ActionBar Theme and Android Style

Customizing the overall App Style

This guide has been updated for Titanium SDK 3.3.0 which uses AppCompat to bring the ActionBar to Android 2.3.x

Android has a build-in theming system. Using this feature you can easily change the base color Android uses for its controls across your app, allowing you to provide better branding and personalization, while maintaining Android's UI and UX.

Android built-in themes are:

  • Holo (Mostly Black and Cyan)
  • Holo Light (Mostly White and Gray)
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active July 23, 2024 04:22
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

/* Non-responsive overrides for Bootstrap 3
*
* Utilize the following CSS to disable the responsive-ness of the container,
* grid system, and navbar.
*/
/* Reset the container */
.container {
max-width: none !important;
width: 970px;