Skip to content

Instantly share code, notes, and snippets.

View mashhoodr's full-sized avatar
🏎️
being awesome!

Mashhood Rastgar mashhoodr

🏎️
being awesome!
View GitHub Profile
@mashhoodr
mashhoodr / eng_bootrap_harness.md
Created April 10, 2026 14:14
Engineering Harness Bootstrap

Context Engineering Harness Bootstrap

For: Any team member setting up Claude Code on their repo
Time: 2–4 hours for a full build, 30 min for a minimal starter
What you get: A self-reinforcing AI development environment that enforces quality, loads context intelligently, tracks work, and improves itself over time.


What you're building and why

A harness is two things working together:

@mashhoodr
mashhoodr / cloudflare_worker_proxy.js
Last active October 10, 2022 16:01
A simple proxy pass script for Cloudflare Worker which handles the basic cases
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
/**
* Respond to the request
* adapted from https://github.com/xiaoyang-liu-cs/workers-proxy
* @param {Request} request
*/
async function handleRequest(request) {
@mashhoodr
mashhoodr / secure.bash
Last active June 23, 2016 08:36
Secure Ubuntu
#!/bin/bash
set -o errexit
# Disclaimer: This is not the most secure configuration possible. This script
# is only intended to be more secure than the default configuration. No
# promises are made about this script preventing your server from getting
# owned or your bike getting stolen. The bad guys are still out to get you.
# And running this script does not excuse you from writing secure application
# code!
@mashhoodr
mashhoodr / angular-cli-ubuntu-setup.sh
Last active May 30, 2016 11:23
Setup angular-cli on ubuntu14
# navigate to the project folder
# git pull latest version
# make sure user has permission to write in that folder
# install latest node
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo npm install angular-cli -g
sudo npm install -g typings@0.8.1 # make sure its version 0.8.1 latest ones breaks
@mashhoodr
mashhoodr / zip.sh
Created May 29, 2014 06:11
Zips a list of files without their folder structure
find $basePath -name "$pattern" -print | zip -j "$outputFileName" -@
@mashhoodr
mashhoodr / create_zip.scala
Last active March 9, 2016 20:35
Create a zip file using remote sources (S3) and then download that zip file in Scala
import java.io.{File}
import java.util.zip.{ZipEntry, ZipOutputStream}
val zipFilePath = "/tmp/allLogs.zip"
val zip = new ZipOutputStream(new FileOutputStream(zipFilePath))
for (log <- logs) {
val link = file.link.get
val fileName = link.substring(link.lastIndexOf('/') + 1, link.lastIndexOf(".zip") + 4) // getting file name and removing the AWS params from the link
val source = scala.io.Source.fromURL(link, "ISO-8859-1") // this is because I am zipping binary files, if your encoding is different please pass likewise
@mashhoodr
mashhoodr / compare.rb
Last active November 22, 2017 19:06
Comparing images in cucumber - calabash
require 'oily_png'
require 'open-uri'
include ChunkyPNG::Color
def starts_with(item, prefix)
prefix = prefix.to_s
item[0, prefix.length] == prefix
end
# compares two images on disk, returns the % difference
@mashhoodr
mashhoodr / authorization_cocoa.m
Last active December 29, 2015 21:19
A hack to do something with Administrator privileges in Cocoa. This saves you from implementing the fairly complicated route of getting the administrative right using BetterAuthorizationSample example
NSDictionary *error = [NSDictionary dictionary];
NSAppleScript *run = [[NSAppleScript alloc]
initWithSource:@"do shell script "gem install calabash-cucumber;" with administrator privileges"];
[run executeAndReturnError:&error];
def select_date(date_string)
date = Date.parse(date_string)
query("view:'_UIDatePickerView'", [{:selectRow => date.month - 1}, {:inComponent => 0}, {:animated => 1}])
query("view:'_UIDatePickerView'", [{:selectRow => date.day - 1},   {:inComponent => 1}, {:animated => 1}])
query("view:'_UIDatePickerView'", [{:selectRow => date.year - 1},  {:inComponent => 2}, {:animated => 1}])
sleep(0.4)
# the query does not create a UIControlEventValueChanged event, so we have to do a touch event
picker_scroll_up_on_column 0
sleep(0.4)
picker_scroll_down_on_column 0
@mashhoodr
mashhoodr / styling_nstextfields
Last active December 29, 2015 21:19
A snippet for styling the NSTextfields properly [http://imars.info/styling-nstextfields-cocoa-development/]
- (void)drawWithFrame:(NSRect)cellFrame
inView:(NSView *)controlView {
NSImage *img = [NSImage imageNamed:@"tf"];
[img drawAtPoint:NSPointFromCGPoint(CGPointMake(0, 0))
fromRect:NSZeroRect
operation:NSCompositeSourceOver
fraction:1];
cellFrame.origin.x += 10;
cellFrame.origin.y += 16;