Skip to content

Instantly share code, notes, and snippets.

@bowsersenior
bowsersenior / build.gradle
Created March 26, 2021 20:12 — forked from medvedev/build.gradle
Gradle task that prints total dependencies size and (dependency+(size in kb)) list sorted by size desc
...
/* Tested with Gradle 6.3 */
tasks.register("depsize") {
description = 'Prints dependencies for "default" configuration'
doLast() {
listConfigurationDependencies(configurations.default)
}
}

This is all based on the [alpha release][1].

Properties

From the built-in help system:

For many settings TextMate will look for a .tm_properties file in the current folder and in any parent folders (up to the user’s home folder).

These are simple setting = value listings where the value is a format string in which other variables can be referenced.

# My pimped out unicorn config, with incremental killof
# and all the latest capistrano & bundler-proofing
# @jamiew :: http://github.com/jamiew
application = "000000book.com"
environment = ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'production'
app_path = "/srv/#{application}"
bundle_path = "#{app_path}/shared/bundle"
timeout 30
@bowsersenior
bowsersenior / constructorDemo.js
Last active December 14, 2015 19:28
Demo of JavaScript constructor property. Illustrates that the constructor property is set automatically by JavaScript, but is overwritten when a custom prototype is assigned, necessitating the constructor to be explicitly set in the prototype. For more info, refer to http://nerdstuckathome.wordpress.com/2012/11/06/a-quick-digression-about-the-co…
function Nuttin() {};
function Sumtin() {};
Sumtin.prototype = { foo: function(){} };
function SumtinElse() {};
SumtinElse.prototype = { bar: function(){}, constructor: SumtinElse };
function AnotherSumtinElse() {};
Object.defineProperty(AnotherSumtinElse, "prototype", { value: {bar: function(){}, constructor: AnotherSumtinElse }});
require 'openssl'
require 'base64'
require 'uri'
# inspired by Amazon's AWS auth (also used by Twilio)
# see:
# * http://www.thebuzzmedia.com/designing-a-secure-rest-api-without-oauth-authentication/
# * https://github.com/amazonwebservices/aws-sdk-for-ruby/blob/master/lib/aws/core/signer.rb
# * https://github.com/amazonwebservices/aws-sdk-for-ruby/blob/master/lib/aws/core/signature/version_4.rb
# * https://github.com/twilio/twilio-ruby/blob/master/lib/twilio-ruby/util/request_validator.rb
@bowsersenior
bowsersenior / nmap-simple.md
Created November 3, 2012 06:11
Sample gauntlt attack
Feature: simple nmap attack (sanity check)

  Background:
    Given "nmap" is installed
    And the following profile:
      | name | value |
      | hostname | example.com |

 Scenario: Verify server is available on standard web ports
@bowsersenior
bowsersenior / README.md
Created August 18, 2012 17:04
Gauntlt with turnip

Proof of concept of using Turnip as the engine for gauntlt

How to use this code

TL;DR

$ git clone git://gist.github.com/3388412.git spec
$ gem install turnip aruba
$ rspec -r ./spec/spec_helper.rb -r ./spec/steps/gauntlt_steps.rb spec/nmap_turnip.attack --format documentation
@bowsersenior
bowsersenior / mountain-lion-brew-setup.markdown
Created July 27, 2012 18:39 — forked from yetanothernguyen/mountain-lion-brew-setup.markdown
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from http://developer.apple.com. You will not be able to submit apps to any stores using this XCode version, so turn away if that is something you might want to do.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

@bowsersenior
bowsersenior / every_combo.rb
Created July 25, 2012 00:59
Find every possible combination of a hash
class Hash
def every_combo
arr = self.to_a
1.upto(arr.size).inject([]) do |memo, n|
memo << arr.combination(n).to_a.map{|a| Hash[a] }
memo
end.flatten
end
end
# custom current_gemset check
function my_rbenv_current_gemset(){
rbenv gemset active &>/dev/null
if [ $? -eq 0 ]; then
local gemset="$(rbenv gemset active 2>/dev/null)"
echo "$gemset"
else # an error status means no gemsets
echo "NO_GEMSET"
fi