Skip to content

Instantly share code, notes, and snippets.

View ldante86's full-sized avatar

Luciano Dante Cecere ldante86

View GitHub Profile
@ldante86
ldante86 / polybius.pl
Last active May 14, 2018 07:47
encode/decode Polybius cyphers
#!/usr/bin/perl
use strict;
use warnings;
use 5.010;
my $polybius;
my %polybius = (
"a" => "11",
"b" => "12",
@ldante86
ldante86 / ordinal.pl
Created January 4, 2018 09:55
Return the ordinal of a number
use strict;
use warnings;
use 5.010;
sub ordinal {
my $x = $_[0];
if ( $x <= 20 ) {
return $x . "st\n" if $x == 1;
return $x . "nd\n" if $x == 2;
@ldante86
ldante86 / random.pl
Created December 14, 2017 18:39
Perl functions for printing random strings
#!/usr/bin/perl
use strict;
use warnings;
use 5.010;
# Purpose: generate random strings
# Usage: random1(50);
# Default length is 8.
@ldante86
ldante86 / bash-to-json.sh
Created November 23, 2016 05:21
create JSON objects from bash functions
#!/bin/bash -
PROGRAM="${0##*/}"
if [ $# -eq 0 ]; then
echo "$PROGRAM: create JSON objects from bash functions"
echo "Usage: $PROGRAM file1.sh file2.sh [> file.json]"
exit 1
fi
@ldante86
ldante86 / CalendarData.py
Last active November 23, 2016 05:29
ideas for lcal.py
#!/usr/bin/env python3.4
import time
import sys
class CalendarData:
monthNames = [0,"January","February","March","April","May","June","July",
"August","September","October","November","December"]
dayNames = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]
@ldante86
ldante86 / clock.sh
Created November 22, 2016 07:23
a fun banner/figlet clock
#!/bin/bash -
while clear
do
# /usr/bin/figlet -f big $(date +%I:%M:%S)
/usr/bin/banner $(date +%I:%M:%S)
read -sn1 -t 1
[ $REPLY ] && clear && break
done
@ldante86
ldante86 / fmt-phone.sh
Created November 22, 2016 07:18
phone number formatter
#!/bin/bash -
_format_phone_number()
{
local one
local phone="$(tr -d '[:punct:]' <<< $1)"
if [[ $phone = *[!0-9]* ]] ||
[ ${#phone} -lt 3 ] ||
[ -z "$phone" ]
@ldante86
ldante86 / launcher.sh
Created November 22, 2016 07:15
desktop launcher tool
#!/bin/bash -
printf "\n%s\n\n" "Create a .desktop launcher"
# because Unity doesn't have a launcher tool...
read -p "Name the launcher: " name
[ -z "$name" ] && exit 1
read -p "Code to execute: " execute
[ -z "$execute" ] && exit 1
@ldante86
ldante86 / hebrew.rb
Created November 22, 2016 07:11
Hebrew module -- unfinished
# This module is not finished.
module Hebrew
def self.j_to_sdn(m, d, y)
m, d, y = m.to_i, d.to_i, y.to_i
if y == 0 || y < -4713 || m <=0 || m > 12 || m <= 0 || d > 31
return(0)
end
@ldante86
ldante86 / bashlet_get_methods.sh
Last active November 19, 2016 23:29
get bashlet method names from lib file name
#!/bin/bash -
#
# SCRIPT: bashlet_get_methods.sh
# AUTHOR: Luciano D. Cecere
# DATE: 11/19/2016-01:03:13 PM
########################################################################
#
# bashlet_get_methods - get bashlet method names from lib file name
# Copyright (C) 2016 Luciano D. Cecere <ldante86@aol.com>
#