This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To install this script as a context menu item, add this to the registry: | |
# key: \HKEY_CLASSES_ROOT\*\shell\Backup\command | |
# default data: C:\Ruby26-x64\bin\rubyw.exe C:\Scripts\backup.rb "%1" | |
# And place this file at C:\Scripts\backup.rb | |
require 'fileutils' | |
require 'time' | |
src = ARGV.first | |
exit unless src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Read CSV data from STDIN, output a WITH clause containing the CSV data | |
require 'csv' | |
csv = CSV.parse($stdin, headers: true, converters: :numeric, header_converters: :symbol) | |
columns = csv.headers.join(",") | |
cte_name = ENV.fetch("CTE_NAME", 'temp') |
Usage:
Open 2 terminals, run server.rb
in one and client.rb
in the other. The tcp socket file descriptor will be created in the client, passed to the server, and then used in the server to read from the HTTP server.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'excon' | |
require 'json' | |
module EnumerableEnumerator | |
def self.included(base) | |
base.extend ClassMethods |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -L https://github.com/rlmcpherson/s3gof3r/releases/download/v0.5.0/gof3r_0.5.0_linux_amd64.tar.gz | tar -zxv --strip-components 1 -C /app/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -x | |
# http://lartc.org/howto/lartc.qdisc.classful.html | |
# A single user has 5000kbit upload for himself. But they want prioritizing. | |
# Variables | |
TC=$(which tc) | |
IPT=$(which iptables) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`ruby -ruri -e 'uri = URI.parse(ENV["DATABASE_URL"]); puts %(env PGPASSWORD=#{uri.password} psql --dbname=#{uri.path[1..-1]} --host=#{uri.host} --port=#{uri.port} --username=#{uri.user} --no-password)'` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A chef definition for installing kernel modules on ubuntu/debian. | |
define :kernel_module, :action => :install do | |
if params[:action] == :install | |
bash "modprobe #{params[:name]}" do | |
code "modprobe #{params[:name]}" | |
not_if "lsmod |grep #{params[:name]}" | |
end | |
bash "install #{params[:name]} in /etc/modules" do |
NewerOlder