Skip to content

Instantly share code, notes, and snippets.

@at1as
at1as / valid_ssn.sh
Created June 12, 2016 03:29
Generate a valid Social Security Number
#!/bin/bash
# Generate a valid Social Security Number
function generate() {
SSN=""
valid=0
for i in {1..9}; do
DIGIT=$[RANDOM%9+1]
@at1as
at1as / Ruby_Reference.md
Last active May 6, 2019 01:51
Ruby Reference

A few rough notes I used as a Ruby reference as I was beginning to learn the language.

Object Concepts

Modules

A module is a way to group together methods, classes and constants and is designed to be accessed by many classes. These provide some advantages, one of which is that they are a sandboxed environment, and that they can be accessed by many classes. Modules cannot be instantiated, but are rather extended or included.

Extends versus Includes

@at1as
at1as / bits.erl
Last active February 22, 2017 06:32
Assignment #1 Functional Programming in Erlang
-module(bits).
-export([bits/1, bitsNoTailRecursion/1, startTests/0]).
%% Functional Programming in Erlang
%% Kent University
%% 21 February 2017
%% Exercise 1 : Summing the Bits
%%
@at1as
at1as / Automation Tools and Libraries.md
Last active December 28, 2016 11:11
Test Automation Tools and Librarys

A list of a few useful Automation Tools & Libraries. Each of these have their pros and cons, but a combination of a few of these can give you pretty good test coverage without a lot of effort.

API Testing

Load Test

  • [JS Script] Runs a load test on the selected URL. Easy to extend minimally for your own ends.

API Tester

@at1as
at1as / facetime_kill.sh
Created December 5, 2016 05:30
Kill FaceTime app after X seconds
#!/bin/bash
# Usage : ./facetime_kill.sh 10
# Accepts 1 argument : a number of seconds before stopping app
if [[ $1 ]]
then
echo "Killing Facetime in ${1} seconds"
i=$1
@at1as
at1as / oxford_comma
Created July 4, 2016 03:26
Add oxford comma to script
jason$ echo "a, b, c and d. e, f, g, and h" | sed 's/\([^,]\)\(\ and\)/\1\,\2/g'
> a, b, c, and d. e, f, g, and h

Keybase proof

I hereby claim:

  • I am at1as on github.
  • I am willems (https://keybase.io/willems) on keybase.
  • I have a public key ASBJanSm1SKbTunlyBBTt_3BFB8mjHGMiLPmvpjFRO9Zlwo

To claim this, I am signing this object:

# A Natural Sort Algorithm in one line
ITEMS = %W(item1 item2 item11 item1 item20 item3 hello other_item other_item7 item)
TRAILING_NUM = /[0-9]*\Z/
natural_sorted = ITEMS.sort.chunk{ |y| y.gsub(TRAILING_NUM, '') }.to_a.map{ |k_v| k_v[1] }.each{ |x| x.sort_by!{ |z| z.scan(TRAILING_NUM).first.to_i }}.flatten
puts natural_sorted
# => ["hello", "item", "item1", "item1", "item2", "item3", "item11", "item20", "other_item", "other_item7"]
@at1as
at1as / webServerData.py
Last active January 1, 2016 07:09
Simple python script to extract basic website information (derived from curl request + ping), and display is cleanly. Example output below:Status: HTTP/1.1 200 OK,Server: Apache,Server Time: Mon, 23 Dec 2013 22:00:00 GMT,Actual Time: 2013-12-23 22:00:12.601447,Encoding: UTF-8,Default Path: example.com/Home.html,URL Lowercase: False,Has Favicon: …
#!/bin/bash/env python2.7
from subprocess import Popen, PIPE, STDOUT
import re
import datetime
site = 'example.com' #enter website URL here
favicon = False
ssl_enabled = False
@at1as
at1as / carryOperations.py
Last active December 28, 2015 22:29
Will return the number of carry operations performed when adding two positive numbers
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
'''
Will return the number of carry operations performed in positive integer addition
'''
carryover, carryCount = False, 0
while True: #accept positive integer values as input
try: