Skip to content

Instantly share code, notes, and snippets.

View saneshark's full-sized avatar

Kam Karshenas saneshark

View GitHub Profile
@saneshark
saneshark / encryptor.rb
Created August 24, 2018 06:00
OpenSSL command-line compatible aes-256-cbc in ruby
require 'openssl'
require 'base64'
require 'pry'
puts 'If you wish to generate a new set of keys and init vectors without salt:'
puts 'openssl enc -nosalt -aes-256-cbc -k <YOUR PASSPHRASE> -P'
puts 'with salt:'
puts 'openssl enc -aes-256-cbc -k <YOUR PASSPHRASE> -P'
puts
# Given a file with the text 'Hello World'

Keybase proof

I hereby claim:

  • I am saneshark on github.
  • I am saneshark (https://keybase.io/saneshark) on keybase.
  • I have a public key ASAIkzyrTc3Uphdk5bdfiVYV4rDJhKLQOsLsVICTfPHrzwo

To claim this, I am signing this object:

def array_flattener(array)
raise ArgumentError, 'Argument must an array' unless array.is_a? Array
flattened_array = []
array.each do |element|
if element.is_a? Array
flattened_array += array_flattener(element)
else
flattened_array << element
end
end
@saneshark
saneshark / bash_profile
Created August 26, 2014 17:57
custom bash profile
# terminal color setting
#terminal color setting
export PATH="/usr/local/bin:$PATH"
export TERM=xterm-color
export CLICOLOR=1
export LSCOLORS=gxfxaxdxcxegedabagacad
# color the ls output
alias ls='ls -G'
# shortcut for detailed listing
@saneshark
saneshark / get.sh
Created September 11, 2013 00:46
curl / shell scripts for testing apis
#!/bin/bash
CURL='/usr/bin/curl'
MAINURL="https://api.myserver.com"
ACTION="users"
USERNAME="api_tester@myserver.com"
PASSWORD="secret"
PARAMS_TO_TEST="&company_id=1"
CURLARGS="-k"