Skip to content

Instantly share code, notes, and snippets.

@keverw
keverw / gist:dd82b8d6ae9311176a88955a02798eaa
Last active October 17, 2017 21:10
Cleanup Apple Notes leftover in Gmail (I moved my notes to iCloud but noticed it kept a bunch of leftovers of every single revision every in gmail, so wrote a small script to remove them to a label to review/delete anything no longer needed)
var Imap = require('imap'),
inspect = require('util').inspect;
var imap = new Imap({
user: 'yourname@gmail.com',
password: 'yourpassword',
host: 'imap.gmail.com',
port: 993,
tls: true
});
@keverw
keverw / gist:3118602
Created July 15, 2012 20:58
Birthdate
//
// main.m
// structure
//
// Created by Kevin Whitman on 7/15/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@keverw
keverw / gist:3027638
Created July 1, 2012 09:17
PHP HTML encoding
<?php
$headers = 'From: ' . $fromname . ' <' . $fromaddress . ">\r\n";
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=UTF-8' . " \r\n";
?>
@keverw
keverw / lslquerystring.lsl
Created June 14, 2012 22:56
http query string parse
list convertHttpQ(string str) //converts strided list to query string
{
list strided_output = [];
//remove ?
string first_letter = llGetSubString(str, 0, 0);
if (first_letter == "?")
{
str = llGetSubString(str, 1, llStringLength(str));
}
@keverw
keverw / gist:2922027
Created June 13, 2012 05:22
Mac say, Have your JavaScript Node.js app make your Mac speak.
global.escapeshell = function(cmd) { //http://stackoverflow.com/a/7685469
return '"'+cmd.replace(/(["\s'$`\\])/g,'\\$1')+'"';
};
global.say = function(string)
{
var os = require('os');
if (os.type() == 'Darwin')
{
@keverw
keverw / gist:2862894
Created June 3, 2012 10:09
A Recaptcha module I wrote for my Node.js app. It depends on https://github.com/keverw/HTTPRequest
var recaptcha_settings = {
api_server: 'http://www.google.com/recaptcha/api',
api_secure_server: 'https://www.google.com/recaptcha/api',
verify_server: 'www.google.com',
verify_path: '/recaptcha/api/verify'
}
module.exports = {
get_html: function (pubkey, callback, error, use_ssl) //returns HTML
{
@keverw
keverw / gist:2598281
Created May 4, 2012 23:12
Tiny node.js bot
var irc = require('irc');
console.log('IRC Bot Started...');
var client = new irc.Client('irc.ztecnet.net', 'JustinBieber', {
channels: ['#ztecnet'],
});
client.addListener('message#ztecnet', function (from, message) {
console.log(from + ' => #ztecnet: ' + message);