Skip to content

Instantly share code, notes, and snippets.

View tlongren's full-sized avatar
🎯
Focusing

Tyler Longren tlongren

🎯
Focusing
View GitHub Profile
@rexcze-zz
rexcze-zz / custom_live.sh
Last active January 12, 2023 01:05
Ubuntu livecd creation script
#!/bin/sh
#https://help.ubuntu.com/community/LiveCDCustomization
#set -e
if [ "$1" = "" ];then
echo "Call this script with part1, part2 or clean as argument"
exit 0
fi
IMAGE_NAME="LIVE_TEST"
ISO="kubuntu-12.04.2-desktop-i386.iso"
@troy
troy / send_remote_syslog.php
Last active April 6, 2023 18:19
Send UDP remote syslog message from PHP (RFC 3164)
# replace PAPERTRAIL_HOSTNAME and PAPERTRAIL_PORT
# see http://help.papertrailapp.com/ for additional PHP syslog options
function send_remote_syslog($message, $component = "web", $program = "next_big_thing") {
$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
foreach(explode("\n", $message) as $line) {
$syslog_message = "<22>" . date('M d H:i:s ') . $program . ' ' . $component . ': ' . $line;
socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, PAPERTRAIL_HOSTNAME, PAPERTRAIL_PORT);
}
socket_close($sock);
@lunaru
lunaru / css3-arrow-dropshadow.html
Created April 25, 2012 23:18
CSS Box with Arrow and Dropshadow
<!DOCTYPE html>
<html>
<head>
<style>
/* Core CSS */
#box
{
background: white;
@retgef
retgef / pug-bomb.php
Created June 24, 2012 07:46
Pug Bomb API Endpoint WordPress Plugin
<?php
/*
Plugin Name: Pug Bomb API Endpoint
Description: Adds an API endpoint at /api/pugs/$n_pugs
Version: 0.1
Author: Brian Fegter
Author URL: http://coderrr.com
*/
class Pugs_API_Endpoint{
@HarryR
HarryR / newrelic.php
Created July 25, 2012 16:13
NewRelic API for PHP
<?php
class NewRelic_Error extends Exception {}
function NewRelic_Date(DateTime $date) {
return $date->format('Y-m-d') . 'T' . $date->format('H:i:s') . 'Z';
}
function NewRelic_Metrics2Array(SimpleXMLElement $result) {
$return = array();
@havvg
havvg / ajax-form.js
Created August 1, 2012 13:20
jQuery AJAX form submit with Twitter Bootstrap modal
jQuery(function($) {
$('form[data-async]').live('submit', function(event) {
var $form = $(this);
var $target = $($form.attr('data-target'));
$.ajax({
type: $form.attr('method'),
url: $form.attr('action'),
data: $form.serialize(),
@johntyree
johntyree / getBlockLists.sh
Last active March 9, 2024 12:32
Make one large blocklist from the bluetack lists on iblocklist.com
#!/usr/bin/env sh
# Download lists, unpack and filter, write to stdout
curl -s https://www.iblocklist.com/lists.php \
| sed -n "s/.*value='\(http:.*=bt_.*\)'.*/\1/p" \
| xargs wget -O - \
| gunzip \
| egrep -v '^#'
@jerone
jerone / addon.js
Created August 27, 2012 11:48
jQuery Ping domain/ip with Deferred
/*
Ping
*/
$.extend($, {
Ping: function Ping(url, timeout) {
timeout = timeout || 1500;
var timer = null;
return $.Deferred(function deferred(defer) {
@jkuemerle
jkuemerle / payment.php
Created October 15, 2012 04:04
Payment Processing Top
<?php
require_once("Stripe.php");
Stripe::setApiKey('<secret key>');
$name = htmlspecialchars($_POST["name"]);
$address1 = htmlspecialchars($_POST["address1"]);
$city = htmlspecialchars($_POST["city"]);
$state = htmlspecialchars($_POST["state"]);
$zip = htmlspecialchars($_POST["zip"]);
$email = htmlspecialchars($_POST["email"]);
@claudiodangelis
claudiodangelis / fixNavbarIssue.js
Created November 8, 2012 21:08
[bootstrap] fixing issue #4153 `navbar-fixed-top`
function fixNavbarIssue(){
/* Quick & dirt draft fix for the bootstrap's navbar-fixed-top issue.
Overview
When you call a given section of a document (e.g. via <a href="#section"> or domain.com/page#section1) browsers show that section at the top of window. Bootstrap's navbar-fixed-top, _since it's fixed_, *overlays* first lines of content.
This function catches all of the <a> tags pointing to a section of the page and rewrites them to properly display content.
Works fine even if a # section is called from URL.
Usage