Skip to content

Instantly share code, notes, and snippets.

View hdmn's full-sized avatar
🥸

hdmn hdmn

🥸
View GitHub Profile
@sanbornm
sanbornm / gist:177420
Created August 29, 2009 07:14
Simple script to check when your site changes status codes
import pickle, pprint, time, os
import httplib
import smtplib
def emailAlert(alert,subject='You have an alert'):
fromaddr = "youremail@domain.com"
toaddrs = "youremail@domain.com"
# Add the From: and To: headers at the start!
@jaywilliams
jaywilliams / csv_to_array.php
Created April 30, 2010 23:18
Convert a comma separated file into an associated array.
<?php
/**
* Convert a comma separated file into an associated array.
* The first row should contain the array keys.
*
* Example:
*
* @param string $filename Path to the CSV file
* @param string $delimiter The separator used in the file
* @return array
<div class="nav prevnext">
<? if($page->hasPrevVisible()): ?>
<a class="prev" href="<?= $page->prevVisible()->url() ?>">&lsaquo; previous article (<?php echo html($page->prevVisible()->title()) ?>)</a>
<? endif ?>
<? if($page->hasNextVisible()): ?>
<a class="next" href="<?= $page->nextVisible()->url() ?>">next article &rsaquo; (<?php echo html($page->nextVisible()->title()) ?>)</a>
<? endif ?>
@dweeber
dweeber / rpiGpioSensor.bash
Created September 3, 2012 15:36
Intial script for sensing GPIO pin dropping to reset RPi
#! /bin/bash
# Originally posted to http://www.raspberrypi.org/phpBB3/viewtopic.php?f=29&t=14255
# This script is used to check a pin at half second intervals and
# will shutdown the system if the pin is at a low level.
# Portions of this script adapted from "GPIO Driving Example (Shell script)"
# found on elinux.org .
@shoesforindustry
shoesforindustry / kirbycms-multifilterby.php
Last active July 18, 2024 11:15
Kirby CMS Multi Filter based on FilterBy with form selection. The idea was to be able to add fields to pages and be able to have a combined multi-filter to select pages which match *all* the filters. Select your filters and then hit the 'Filter' button: A list of selected filters will be displayed and if there are matches the pages names are dis…
<?php
#Pages have these fields, they can have comma separated values for group, category and option
# Title: Event1
# ----
# Group: Group1
# ----
# Category: Cat2
# ----
# Option: Option1
@jonathonbyrdziak
jonathonbyrdziak / .htaccess
Last active July 10, 2024 11:27
htaccess mod_expires / mod_cache / mod_deflate / mod_headers
# ------------------------------------------------------------------------------
#
# Curtousy of the Magento Support Center
# http://magentosupport.help/what-are-expires-headers-and-how-do-i-implement-them/
#
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# | Mod Caching via Apache |
@iimos
iimos / optimize-images.sh
Last active August 21, 2023 08:50
Script for JPEG images optimization
#! /bin/sh
# Usage 1:
# optimize-images.sh /images/dir
#
# Usage 2:
# cd /images/dir
# optimize-images.sh
EXTENSIONS="jpe?g"
@flazer
flazer / gpstimesync.py
Created November 18, 2013 09:01
Connects to your GPS-Dongle and synchronize systemtime with GPS-UTC-time. Handles local-timezones Needs PYTZ-Library: http://pytz.sourceforge.net/#installation
#! /usr/bin/python
#####################
# GPS-TIME-SYNC #
# 2013 flazer #
# info@flazer.net #
#####################
# Connects to your GPS-Dongle and synchronize systemtime with GPS-UTC-time.
# Handles local-timezones
<?php $zeiten = page('oeffnungszeiten') ?>
<?php if($zeiten->status() == 'normal'): ?>
<!-- hier werden die öffnungszeiten abhängig vom tag angezeigt -->
<?php else if($zeiten->status() == 'open'): ?>
<!-- hier wird einfach nur angezeigt dass geöffnet ist -->
<?php else: ?>
<!-- hier wird angezeigt dass geschlossen ist -->
<?php endif ?>
@c0deaddict
c0deaddict / hd44780.lua
Created November 13, 2015 21:22
NodeMCU HD44780
local bor, band, bnot = bit.bor, bit.band, bit.bnot
local function write4bits(self, bits, char_mode)
tmr.delay(1000)
gpio.write(self.pin_rs, char_mode and gpio.HIGH or gpio.LOW)
for n = 1, 2 do
for i, pin in ipairs(self.pin_db) do
local j = (2-n)*4 + (i-1)
local val = (bit.isset(bits, j))