Search found 11 matches: Function

Searched query: function

by jessica
Mon Nov 26, 2018 2:00 pm
Forum: Born Again Shell Scripting
Topic: Valid IP Address
Replies: 0
Views: 104

Valid IP Address

A BASH script to test for valid IP Addresses Dxw1LBzN #!/bin/bash function valid_ip() { local ip=$1 local stat=1 if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then OIFS=$IFS IFS='.' ip=($ip) IFS=$OIFS [[ ${ip[0]} -le 255 && ${ip[1]} -le ...
by jessica
Fri Sep 14, 2018 11:44 am
Forum: Ruby
Topic: It's beer time!
Replies: 0
Views: 179

It's beer time!

... Notice the variables I have defined, count, containerType and getDrunkBy, these will play a part in the creation of the song. Also there is a function called getDrunkBy which will shuffle the 3 sentence in the song as if they were getting drunk. Have fun and enjoy. 0K6Bxafj puts; puts " It's ...
by jessica
Wed Sep 12, 2018 6:09 am
Forum: PHP
Topic: Bot Detection System
Replies: 0
Views: 232

Bot Detection System

... private $lfPath; private $masterFile; private $botFile; private $mdCheckFile; private $hashVals; private $hashFileVals; private $output; public function __construct(){ $this->url = "http://www.robotstxt.org/db/all.txt"; $this->lfPath= substr(__FILE__,0,strripos(__FILE__,'\\')+1).'robots'; $this->masterFile= ...
by jessica
Mon Sep 10, 2018 10:13 am
Forum: C#
Topic: First and Last of Dates Function
Replies: 0
Views: 176

First and Last of Dates Function

I didn't create this, although I use it quite often. A nice little way of getting dates for first and last. 3RC2biM4 public static partial class DateTimeExtensions { public static DateTime FirstDayOfWeek(this DateTime dt) { var culture = System.Threading.Thread.CurrentThread.CurrentCulture; var diff...
by jessica
Mon Sep 10, 2018 6:24 am
Forum: Powershell Scripting
Topic: Windows Product Key
Replies: 0
Views: 113

Windows Product Key

... that is on the Windows machines. Instead of scrolling through a bunch of Registry Items, I figured I would write a PS script to grab it. aF7chsMt Function Get-WindowsKey { param ($targets = ".") $hklm = 2147483650 $regPath = "Software\Microsoft\Windows NT\CurrentVersion" $regValue = "DigitalProductId" ...
by jessica
Sun Sep 09, 2018 10:40 am
Forum: Born Again Shell Scripting
Topic: Menu Driven Linux Info System
Replies: 0
Views: 216

Menu Driven Linux Info System

... # Define variables LSB=/usr/bin/lsb_release # Purpose: Display pause prompt # $1-> Message (optional) function pause(){ local message="$@" [ -z $message ] && message="Press [Enter] key to continue..." read -p "$message" readEnterKey } # Purpose - Display ...
by jessica
Sun Sep 09, 2018 9:44 am
Forum: PHP
Topic: Clean Number
Replies: 0
Views: 146

Clean Number

This function will remove all characters except, 0 – 9, a comma and a decimal. A string is required. qpkcba1X function clean_number($string, $flags='') { $comma = $decimal = $minus = true; $parsedFlags = (count(explode(' ', ...
by jessica
Sun Sep 09, 2018 9:30 am
Forum: PHP
Topic: Decimal to Fraction
Replies: 0
Views: 107

Decimal to Fraction

This function will convert a decimal to a fraction with a denominator up to 128 (example 13/128). This function uses simple PHP math functions.

A number is required.

by jessica
Sun Sep 09, 2018 9:23 am
Forum: PHP
Topic: String to Array Function
Replies: 0
Views: 128

String to Array Function

This function is an ideal way to take a string and have separators to parse keys and values. This is great for giving a definitions list or just have the ability to have an array from long strings. Default separators are == ...
by jessica
Sat Sep 08, 2018 5:36 pm
Forum: PHP
Topic: PHP FuzzBizz
Replies: 0
Views: 97

PHP FuzzBizz

Ni9pSbSD function fizzbuzz($fizz = 3, $buzz = 5, $total = 100, $echo = true){ $output = ''; for($i = 1; $i <= $total; $i++) { $output .= ($i % $fizz == 0 && $i % $buzz == 0 ? "FizzBuzz\n" : ($i % $fizz == 0 ? "Fizz\n" : ($i % ...