Skip to content

Instantly share code, notes, and snippets.

View BenjaminAdams's full-sized avatar
🤠
wrangling up the codes at the wild west corral

Benjamin Adams BenjaminAdams

🤠
wrangling up the codes at the wild west corral
  • Austin, Tx
View GitHub Profile
@amoilanen
amoilanen / webcrawler.js
Last active March 24, 2022 03:14
Simple PhantomJS-based web crawler library
//PhantomJS http://phantomjs.org/ based web crawler Anton Ivanov [email protected] 2012
//UPDATE: This gist has been made into a Node.js module and now can be installed with "npm install js-crawler"
//the Node.js version does not use Phantom.JS, but the API available to the client is similar to the present gist
(function(host) {
function Crawler() {
this.visitedURLs = {};
};
@BenjaminAdams
BenjaminAdams / index.html
Created May 31, 2013 17:16
The iframe upload trick - How to upload files without refreshing the page by submitting the file through a hidden iframe.
<div id='status'></div>
<form id="file-upload-form" name="file-upload-form">
<input type="file" id="upload-doc-file" name="upload-doc-file">
</form>
<iframe id="postiframe" name="postiframe"></iframe>
@TooTallNate
TooTallNate / node-agent-false-assertion-failure.js
Created September 8, 2013 17:28
node v0.11.7 Assertion Failure, caused by HTTP `agent: false`
var url = require('url');
var http = require('http');
var uri = 'http://nodejs.org';
var parsed = url.parse(uri);
parsed.method = 'GET';
// IMPORTANT!
parsed.agent = false;
@BenjaminAdams
BenjaminAdams / upload.js
Created October 1, 2013 07:15
Upload image and/or a file with Javascript
uploadImg: function(file, imgPreview, imgUrl) {
var self = this
console.log('file=', file)
imgPreview.html('<i class="icon-spinner icon-spin"></i>')
imgUrl.val('')
reader = new FileReader();
reader.onload = (function(tFile) {
return function(evt, response) {
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active November 11, 2024 22:46
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@robertsdionne
robertsdionne / deepdream-install.md
Last active February 15, 2021 16:07
Deepdream installation
#!/usr/bin/env bash

# Assuming OS X Yosemite 10.10.4

# Install XCode and command line tools
# See https://itunes.apple.com/us/app/xcode/id497799835?mt=12#
# See https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcode-select.1.html
xcode-select --install
@BenjaminAdams
BenjaminAdams / CountryCodeConverter.cs
Last active May 21, 2024 20:18
C# convert two letter country codes to three letter country codes
public static class CountryCodeConverter
{
public static string ConvertThreeLetterNameToTwoLetterName(string twoLetterCountryCode)
{
if (twoLetterCountryCode == null || twoLetterCountryCode.Length != 2)
{
throw new ArgumentException("name must be three letters.");
}
CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.SpecificCultures);
/*******************************************************
# * By Gunner Technology [email protected]
# *
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version as long as your provide attribution.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of