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 / docker_helpers.sh
Last active May 1, 2018 15:36
Docker & Docker-Compose Cheatsheet
#!/bin/bash
#In amazon linux, Create a Docker group section it is neccesary add user to docker group:
sudo usermod -aG docker $(whoami)
# Build an image
docker build -f DOCKERFILE -t image_name .
# Run a container
docker run -it -p HOSTPORT:CONTAINER_EXPOSED_RPORT --name container_name image_name
@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 / gist:d8d2ad68cac4835d09ba
Created December 10, 2015 18:34
run this on your VPS
#!/bin/bash
lines=$(tput lines)
columns=$(tput cols)
echo "Lines: " $lines
echo "Columns: " $columns
`echo 'wait'` #doesn't work
#system("echo 'wait'") #works
#system("sleep 10") #work
p "done
@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"