Skip to content

Instantly share code, notes, and snippets.

View jasherai's full-sized avatar

Pritesh jasherai

  • Phatforge
  • London
View GitHub Profile
@jasherai
jasherai / tinydkim.py
Created August 3, 2022 19:22 — forked from gwire/tinydkim.py
takes an RSA public key on stdin and outputs a tinydns / djbdns DKIM record
#!/usr/bin/env python
# tinydkim - takes an RSA public key on stdin and outputs a tinydns / djbdns DKIM record
#
# example: openssl rsa -in test.pem -pubout | ./tinydkim.py -s test -d foo.com
#
# TODO: add support for notes field?
#
# 2016 Lee Maguire
function check_up() {
service=$1
host=$2
port=$3
max=13 # 1 minute
counter=1
while true;do
python -c "import socket;s = socket.socket(socket.AF_INET, socket.SOCK_STREAM);s.connect(('$host', $port))" \
http {
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m;
proxy_temp_path /var/tmp;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_comp_level 6;
@jasherai
jasherai / 0-readme.md
Last active December 10, 2015 00:39 — forked from burke/0-readme.md
Fork of burke's rbenv friendly falcon patching script which uses this as the default ruby version (i.e. no -perf suffix on the name)

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@jasherai
jasherai / snippet.txt
Created June 22, 2010 08:39 — forked from danielsdeleo/snippet.txt
including the upstart provider for lucid service
service "mysql" do
# other stuff...
provider Chef::Provider::Service::Upstart
end
require 'rubygems'
require 'merb-core'
Merb::Config.setup(:merb_root => File.expand_path(File.dirname(__FILE__)),
:environment => ENV['RACK_ENV'], :init_file => File.dirname(__FILE__) / "config/init.rb")
Merb.environment = "production" #Merb::Config[:environment]
Merb.root = Merb::Config[:merb_root]
Merb::BootLoader.run
# Uncomment if your app is mounted at a suburi
if Gem.available?('tinder')
require 'tinder'
campfire = Tinder::Campfire.new '<SUBDOMAIN>', :token => '<TOKEN>'
room = campfire.find_room_by_name '<ROOMNAME>'
end
# Put this wherever you want chef to speak:
if Gem.available?('tinder')
room.speak('<HELLOWORLD>')
end
#!/usr/bin/env python
"""
A script to query the Amazon Web Services usage reports programmatically.
Ideally this wouldn't exist, and Amazon would provide an API we can use
instead, but hey - that's life.
Basically takes your AWS account username and password, logs into the
website as you, and grabs the data out. Always gets the 'All Usage Types'
# Author:: Adam Jacob <adam@opscode.com>
# Author:: Joshua Timberman <joshua@opscode.com>
#
# Copyright 2009-2010, Opscode, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#!/bin/sh
# Demo how your can merge opscode chef-repo & cookbooks
# and perm. keep up to date with opscode cookbooks (the last "git" cmd)
% git clone git://github.com/opscode/chef-repo.git
Initialized empty Git repository in /home/tim/src/chef-repo/.git/
remote: Counting objects: 107, done.
remote: Compressing objects: 100% (99/99), done.
remote: Total 107 (delta 45), reused 0 (delta 0)
Receiving objects: 100% (107/107), 16.14 KiB, done.
Resolving deltas: 100% (45/45), done.