Skip to content

Instantly share code, notes, and snippets.

View zotherstupidguy's full-sized avatar

Mo zotherstupidguy

  • hackspree
  • simplicity is the final achievement
View GitHub Profile
@zotherstupidguy
zotherstupidguy / gen_keys.sh
Created October 25, 2016 16:58 — forked from hvasconcelos/gen_keys.sh
Create an Sinatra SSL Server
# Generate a self-signed Certificate and a Private Key
openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout pkey.pem -out cert.crt
@zotherstupidguy
zotherstupidguy / yes_web_api.rb
Created August 18, 2016 05:07 — forked from kimoto/yes_web_api.rb
yes WEB API (Ruby + Sinatra/Streaming)
# coding: utf-8
require 'sinatra'
require 'sinatra/streaming'
set server: 'thin', connections: []
th = Thread.new{
while true
puts "currently connection: #{settings.connections.size}"
settings.connections.each{ |e|
e << "yes\n"
@zotherstupidguy
zotherstupidguy / docker-compose-install.sh
Last active August 10, 2016 10:02 — forked from marszall87/docker-compose-install.sh
Simple script for installing latest Docker Compose on CoreOS >= 717.0.0
#!/bin/bash
# Usage: curl gist-raw-path | sudo sh
mkdir -p /opt/bin
curl -L `curl -s https://api.github.com/repos/docker/compose/releases/latest | jq -r '.assets[].browser_download_url | select(contains("Linux") and contains("x86_64"))'` > /opt/bin/docker-compose
chmod +x /opt/bin/docker-compose
@zotherstupidguy
zotherstupidguy / Guardfile
Created February 19, 2016 15:42 — forked from peterhellberg/Guardfile
External JSON API testing (using minitest/spec, rest-client and yajl-ruby)
guard 'shell' do
watch(/relation_tree_spec\.rb/) { `clear && ruby relation_tree_spec.rb` }
end
@zotherstupidguy
zotherstupidguy / MagnetoREADME.md
Last active January 26, 2016 08:51 — forked from Burgestrand/README.md
A ruby script to construct magnet links out of .torrent files

Magneto

It reads your torrents. Spit out magnet URIs.

Example Usage

$ ./magneto.rb magneto.rb.torrent

Results in:

@zotherstupidguy
zotherstupidguy / config.ru
Created January 11, 2016 10:15 — forked from benben/config.ru
basic ajax/sinatra example
$:.unshift File.expand_path(File.dirname(__FILE__))
require "viz"
run Sinatra::Application
@zotherstupidguy
zotherstupidguy / LICENSE
Created January 3, 2016 17:29 — forked from sinisterchipmunk/LICENSE
tar, gzip, and untar files using ruby in memory without tempfiles
Copyright (C) 2011 by Colin MacKenzie IV
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
@zotherstupidguy
zotherstupidguy / git-find-blob.pl
Created December 26, 2015 21:51 — forked from DaveMessina/git-find-blob.pl
git-find-blob: pass a blob SHA1 and find commits which contain it
#!/usr/bin/perl
use 5.008;
use strict;
use Memoize;
# by Aristotle Pagaltzis <http://stackoverflow.com/users/9410/aristotle-pagaltzis>
# taken from thread http://stackoverflow.com/questions/223678/git-which-commit-has-this-blob
# on 6 june 2010
my $usage =
@zotherstupidguy
zotherstupidguy / git-compressing-and-deltas.md
Created December 21, 2015 18:06 — forked from matthewmccullough/git-compressing-and-deltas.md
Git, Compression, and Deltas - An explanation

Git Compression of Blobs and Packfiles.

Many users of Git are curious about the lack of delta compression at the object (blob) level when commits are first written. This efficiency is saved until the pack file is written. Loose objects are written in compressed, but non-delta format at the time of each commit.

A simple run though of a commit sequence with only the smallest change to the image (in uncompressed TIFF format to amplify the observable behavior) aids the understanding of this deferred and different approach efficiency.

The command sequence:

Create the repo:

@zotherstupidguy
zotherstupidguy / record.sh
Created December 7, 2015 17:30 — forked from mjf/record.sh
Record and replay shell sessions using script(1) and scriptreplay(1)
#! /bin/sh
# Record - record shell session using script(1)
# Copyright (C) 2011 Matous J. Fialka, <http://mjf.cz/>
# Released under the terms of The MIT License
RECORD_PATH="$HOME/.typescripts/%Y/%m/%d"
RECORD_FILE='%H%M%S'
RECORD_TIMING_FILE="$RECORD_FILE.timing"