Skip to content

Instantly share code, notes, and snippets.

View cmbaughman's full-sized avatar
🧐
I may be slow to respond.

Chris Baughman cmbaughman

🧐
I may be slow to respond.
View GitHub Profile
@ihumanable
ihumanable / Excel.php
Last active February 6, 2024 06:24
Simple Excel Writer in PHP
<?php
/**
* Simple excel writer class with no external dependencies, drop it in and have fun
* @author Matt Nowack
* @link https://gist.github.com/ihumanable/929039/edit
* @license Unlicensed
* @version 1.0
*/
class Excel {
@mrclay
mrclay / firstLast.sql
Created April 3, 2012 14:02
MySQL: Extract last and first name(s) from a full "name" field (for Elgg)
SELECT
-- Assumed to be trimmed
name
-- Does name contain multiple words?
,(LOCATE(' ', name) = 0) AS hasMultipleWords
-- Returns the end of the string back until reaches a space.
-- E.g. "John Doe" => "Doe"
-- E.g. "Francis Scott Key" => "Key"
@tobyhede
tobyhede / postsql.sql
Created May 17, 2012 03:08
PostgreSQL as JSON Document Store
-- PostgreSQL 9.2 beta (for the new JSON datatype)
-- You can actually use an earlier version and a TEXT type too
-- PL/V8 http://code.google.com/p/plv8js/wiki/PLV8
-- Inspired by
-- http://people.planetpostgresql.org/andrew/index.php?/archives/249-Using-PLV8-to-index-JSON.html
-- http://ssql-pgaustin.herokuapp.com/#1
-- JSON Types need to be mapped into corresponding PG types
--
@marcedwards
marcedwards / high-dpi-media.css
Last active November 19, 2023 12:56
A CSS media query that captures almost all high DPI aware devices.
/* ---------------------------------------------------------- */
/* */
/* A media query that captures: */
/* */
/* - Retina iOS devices */
/* - Retina Macs running Safari */
/* - High DPI Windows PCs running IE 8 and above */
/* - Low DPI Windows PCs running IE, zoomed in */
/* - Low DPI Windows PCs and Macs running Firefox, zoomed in */
/* - Android hdpi devices and above */
@wkjagt
wkjagt / remove_script_tags.php
Last active November 12, 2020 06:26
Remove script tags from html
<?php
function removeDomNodes($html, $xpathString)
{
$dom = new DOMDocument;
$dom->loadHtml($html);
$xpath = new DOMXPath($dom);
while ($node = $xpath->query($xpathString)->item(0)) {
$node->parentNode->removeChild($node);
}
@JT5D
JT5D / controllable_Webcams.csv
Created January 3, 2014 19:52
controllable Webcams list
We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 22 columns, instead of 8. in line 3.
created_utc,score,domain,id,title,author,ups,downs,num_comments,permalink,selftext,link_flair_text,over_18,thumbnail,subreddit_id,edited,link_flair_css_class,author_flair_css_class,is_self,name,url,distinguished
1315403643.0,462,cracked.com,k7kzm,Writer of Cracked.com mentions this subreddit in their article,penguinsmut,493,31,47,http://www.reddit.com/r/controllablewebcams/comments/k7kzm/writer_of_crackedcom_mentions_this_subreddit_in/,,,False,http://thumbs.reddit.com/t3_k7kzm.png,t5_2qt74,False,,,False,t3_k7kzm,http://www.cracked.com/article_19412_8-things-you-wont-believe-can-be-hacked.html,
1339618071.0,159,209.121.28.211,v0dh3,Now we just wait for kinky elevator sex.,Brudus,173,14,97,http://www.reddit.com/r/controllablewebcams/comments/v0dh3/now_we_just_wait_for_kinky_elevator_sex/,,,False,default,t5_2qt74,False,,,False,t3_v0dh3,http://209.121.28.211/anony/mjpg.cgi,
1349006496.0,148,cryptogasm.com,10phl7,"I created a basic web viewer for a load of webcams I discovered (1,392 and counting).",Rsaesha,163,1
@cmbaughman
cmbaughman / py-captcha.py
Created February 16, 2014 17:49
Script to beat CAPTCHA with Python 3
# A script to bypass the Bugcrowd sign-up page captcha
# Created by @pwndizzle - http://pwndizzle.blogspot.com
from PIL import Image
from urllib.error import *
from urllib.request import *
from urllib.parse import *
import re
import subprocess
@cmbaughman
cmbaughman / GetRSSFeed.js
Created March 5, 2014 16:02
Parse RSS feed as JSON from client using Google API
var rssUrl = "http://www.exploit-db.com/rss.xml";
function parseRSS(url, callback) {
$.ajax({
url: document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=10&callback=?&q=' + encodeURIComponent(url),
dataType: 'json',
success: function(data) {
callback(data.responseData.feed.entries);
}
});
}
@elbuo8
elbuo8 / app.yml
Last active August 29, 2015 14:00
Go AppEngine Post
application: your-app-name
version: 1
runtime: go
api_version: go1
handlers:
- url: /.*
script: _go_app
@nicooprat
nicooprat / output.css
Created April 24, 2014 22:45
Vendor prefix mixin for LESS
/* It should output something like this... Easy ! */
.test {
animation: pulse 0.5s 1 both;
-ms-animation: pulse 0.5s 1 both;
-moz-animation: pulse 0.5s 1 both;
-webkit-animation: pulse 0.5s 1 both;
-o-animation: pulse 0.5s 1 both;
transition: all 0.25s;