Skip to content

Instantly share code, notes, and snippets.

View parolkar's full-sized avatar

Abhishek Parolkar parolkar

View GitHub Profile
@parolkar
parolkar / mailmerge.scpt
Created October 18, 2023 08:41 — forked from johnwickerson/mailmerge.scpt
Mail-merge from a CSV file using Apple Mail
-- Mail-merge script
-- Assembled by John Wickerson (using various parts pasted from the internet, credited individually below) in April 2021.
-- Instructions:
---- 1. Select a message in Mail (probably one that has been saved as a Draft) and then run this script.
---- 2. The script will ask you for a CSV file containing the data to be mail-merged. The first column of this CSV file must be named "email".
---- 3. The script will substitute $FOO in the contents of the message with the contents of column FOO in the CSV file.
---- 4. Any to/cc/bcc recipients in the original message will be preserved.
---- 5. Unfortunately, any attachments in the original message are not preserved, but if you want an attachment, you can add it
---- using this script by uncommenting one of the lines below.
@parolkar
parolkar / router.php
Last active August 29, 2015 14:08 — forked from tamagokun/router.php
<?php
$root = $_SERVER['DOCUMENT_ROOT'];
chdir($root);
$path = '/'.ltrim(parse_url($_SERVER['REQUEST_URI'])['path'],'/');
set_include_path(get_include_path().':'.__DIR__);
if(file_exists($root.$path))
{
if(is_dir($root.$path) && substr($path,strlen($path) - 1, 1) !== '/')
$path = rtrim($path,'/').'/index.php';
require 'redis'
module Nanite
class State
include Enumerable
# this class encapsulates the state of a nanite system using redis as the
# data store. here is the schema, for each agent we store a number of items,
# for a nanite with the identity: nanite-foobar we store the following things:
#
@parolkar
parolkar / 0what.md
Created August 24, 2009 16:28 — forked from defunkt/0what.md

Poor Man's Deploy

  • Start a Sinatra server on port 4000
  • GET / to that server triggers a git pull and mod_rails restart
  • Hit port 4000 locally after pushing

Why?

#!/bin/bash
echo "Setting up chef..."
sudo apt-get -y update
sudo apt-get -y install ruby ruby1.8-dev libopenssl-ruby1.8 rdoc ri irb build-essential wget ssl-cert
cd /tmp
wget http://rubyforge.org/frs/download.php/57643/rubygems-1.3.4.tgz
tar zxf rubygems-1.3.4.tgz
class UsersController < ApplicationController
respond_to :html, :xml, :json
# GET /users
# GET /users.xml
def index
@users = User.all
respond_with(@users)
end
In response to all the responses to:
http://twitter.com/rtomayko/status/1155906157
You should never do this in a source file included with your library,
app, or tests:
require 'rubygems'
The system I use to manage my $LOAD_PATH is not your library/app/tests
#!/usr/bin/env ruby
#
# Example:
# $: git log --numstat -w --summary --date=iso | this.rb
# <timestamp> <added> <deleted>
#
require "time"
DATE = /^Date:(.*)/
DIFF = /^(\d+)\s+(\d+)/
# SUPER DARING APP TEMPLATE 1.0
# By Peter Cooper
# Link to local copy of edge rails
inside('vendor') { run 'ln -s ~/dev/rails/rails rails' }
# Delete unnecessary files
run "rm README"
run "rm public/index.html"
run "rm public/favicon.ico"
# urlmonitor - print out the URLs requested system wide on the main network interface
# Accept a network interface name as an optional argument
iface = ARGV.first
# No interface specified? Try to guess which one is king..
unless iface
`ifconfig -l`.split.each do |iface|
next if iface =~ /^lo/
break if `ifconfig #{iface}` =~ /inet (0|1|2)/