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 'date' | |
require 'optparse' | |
require 'ostruct' | |
# TODO: Add quoting for file option/argument | |
# TODO: See if using 'pathname' stdlib could improve code. | |
# Rails PostgreSQL database backup helper application |
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
## Instructions | |
# 1. Place this file (modified appropriately with your paths) in folder with images to be scaled. | |
# 2. Run this file with Ruby (e.g. "ruby scale_win10_uwp_assets.rb"). | |
## Results | |
# Creates a folder named "compiled_images" with scaled images. | |
## Notes | |
# You should create appropriate versions of your assets for different uses (and their scales and/or targets). |
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
# Contains utilities for working with Prime numbers. | |
class Prime | |
class << self | |
def prime?(n) | |
return false if n < 2 | |
return true if n < 4 | |
return false if n.even? | |
(3..(Math.sqrt n).ceil).each do |i| |
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
require 'pathname' | |
DIRECTORIES_TO_IGNORE = ['.git'] | |
EXTENSIONS_TO_IGNORE = [ # not implemented | |
/^.git*$/, | |
'.DS_Store' | |
].freeze | |
MINIMUM_WIDTH = 3 | |
MOVE_COMMAND = ->(current_path, destination_path) { |
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
;;; dotenv-mode.el --- Major mode for .env files -*- lexical-binding: t; -*- | |
;; Author: Preetpal S. Sohal | |
;; URL: https://github.com/preetpalS/emacs-dotenv-mode | |
;; Version: 0.2.5 | |
;; Package-Requires: ((emacs "24.3")) | |
;; License: GNU General Public License Version 3 | |
;; This program is free software; you can redistribute it and/or modify | |
;; it under the terms of the GNU General Public License as published by |
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 'set' | |
def is_tidy(n) | |
narr = n.to_s.split('') | |
snarr = narr.sort | |
narr.join('') == snarr.join('') | |
end |
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
:: See https://superuser.com/a/289399 for more information on performance of approach. | |
@echo off | |
echo Windows Fast Directory Delete | |
echo Deleting directory: %1 | |
echo Deleting files (within %1) recursively... | |
del /F/S/Q %1 > nul | |
echo Deleting directory (%1) recursively... | |
rmdir /S/Q %1 | |
echo Process complete. |
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
# Sets up clean SIGBREAK signal handling on Windows by taking advantage of existing | |
# SIGINT signal handlers. | |
(-> { | |
Signal.trap(21) do | |
raise SignalException, 'INT' | |
end | |
}).call if Gem.win_platform? |
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 'optparse' | |
require 'ostruct' | |
class RandomPasswordGenerator | |
VERSION = %w(0.1.0) | |
CORE_CHARACTER_SET = [('a'..'z').to_a, | |
('A'..'Z').to_a, |
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
*** RSA | |
# Generate self-signed certificate with RSA 4096 key-pair | |
openssl req -x509 -nodes -days 3650 -newkey rsa:4096 -keyout rsakey.pem -out rsacert.pem | |
# print private and public key | |
openssl rsa -in rsakey.pem -text -noout | |
# print certificate | |
openssl x509 -in rsacert.pem -text -noout |
OlderNewer