New Community BeardBoard

A new community has decided to call ElectroCode its home, ‘BeardBoard‘ as its called, is a community of diverse individuals that have interest in the overall grooming, cleaning, growth, styling, and publicity of facial hair.

Some recount their growth stories. Others may offer advice on what to do to get a specific beard style. Others might be able to tell you if a specific style will look suitable on a specific face structure.

And I’d say I qualify to be in their community.

 

 

 

Wouldn’t you say so? Considering that, I think they’re a great fit for ElectroCode. I hope you think so too.

You can join BeardBoard on ElectroCode by joining #beardboard


Note: This post was supposed to go up a long time ago, but I never got enough time to think fully about it. I sincerely hope you’ll forgive me for being this late to the ‘party’.

 

DNSBL.im

Recently I’ve been working with xnite (owner of IRC-Source.com), on DNSBL.im.

DNSBL.im is meant to be a DNSBL (Domain Name Service Blacklist) for use on IRC and XMPP. And has multiple types that a host can fall under, five to be exact.

Tor 1 Holds Tor exit nodes
HTTP(S) 2 Houses HTTP(S) proxies
SOCKS(4/5) 3 Holds SOCKS(4/5) proxies
 Open Router 4 Holds hosts that have been found to be Open Routers (Routers accessible from the public internet with default credentials)
 Abusive Hosts 5 Holds hosts that have been found to be abusive, this can include spammers on IRC, to SSH Bruteforce-ing hosts we find via FAIL2BAN.

 

We’ve also made DNSBL module blocks for a few different IRCds, just select yours and it will show up.

BOPM/HOPM
InspIRCd
Charybdis (2.2 & later)
UnrealIRCd 4.0.1+

Days till Christmas How To

This post is a follow-up from ‘Easy Way to Get the Difference of Two Times in Python’, seen here. If confused, please read that first, then come back to this.

 

So, continuing from where we left off, lets say we want to get the number of days till christmas. For that, we’d do the following.


#! /usr/bin/python3

import arrow

class CustomArrow(arrow.Arrow):
    def days_till_xmas(self):
        xmas = arrow.Arrow(self.year, 12, 25)
        if self > xmas:
            xmas = xmas.replace(years=1)

        return (xmas - self).days

factory = arrow.ArrowFactory(CustomArrow)
mytime = factory.now()
print(mytime.days_till_xmas())

And boom, that’s it!

Easy Way to Get the Difference of Two Times in Python

This post is quite the short one, but if you ever need the duration/difference between two times, this can come in very handy. But the code may be confusing. So bear with me.

So if you can get the total amount of seconds, which to make it easier, I used the package ‘arrow’.


pip install arrow
pip3 install arrow

Here’s my code, a more stripped down version than what I use.


#! /usr/bin/python3
import arrow
import datetime
def secondsToText(secs):
    days = secs//86400
    hours = (secs - days*86400)//3600
    minutes = (secs - days*86400 - hours*3600)//60
    seconds = secs - days*86400 - hours*3600 - minutes*60
    result = ("{0} day{1}, ".format(int(days), "s" if days!=1 else "") if days else "") + \
    ("{0} hour{1}, ".format(int(hours), "s" if hours!=1 else "") if hours else "") + \
    ("{0} minute{1}, ".format(int(minutes), "s" if minutes!=1 else "") if minutes else "") + \
    ("{0} second{1}".format(int(seconds), "s" if seconds!=1 else "") if seconds else "")
    return result
my_year  = int(input("Year --> "))
my_month = int(input("Month (01-12) --> "))
my_day   = int(input("Day (01-31) --> "))
my_hour  = int(input("Hour (00-23 --> "))
my_min   = int(input("Minute (00-59) --> "))
my_sec   = int(input("Second (00-59) --> "))
my_datetime = datetime.datetime(my_year, my_month, my_day,
                my_hour, my_min, my_sec)
now = arrow.now("US/Eastern")
mypasttime = my_datetime
then = arrow.get(mypasttime, "US/Eastern")
time_diff = now - then
time_days = time_diff.days
time_diff = secondsToText(time_diff.total_seconds())

print(time_diff)

So lets say I wanted the exact length of time(in days + rest) since ElectroCode began.

And while I know the date was January 20th 2012, I don’t exactly know the exact time, so we’ll use Noon(12 00 00)


[email protected]:~$ ./time.py 
Year --> 2012
Month (1-12) --> 01
Day (1-31) --> 20
Hour (0-23 --> 12
Minute (0-59) --> 00
Second (0-59) --> 00
1692 days, 3 minutes, 9 seconds

Now if I wanted to make that able to parse weeks and years, so now I’ll add a few additions to the secondsToText() method.

Results

So with those changes, I now get

4 years, 33 weeks, 1 day, 1 hour, 11 minutes, 38 seconds

If you think there should be changes to this post, leave a comment down below! I can’t improve if there’s no response of what I need to improve on.

See here for other ways to contact me.

Little script I made

I’m a Help Staff on Rizon, and as such we have the responsibility of staffing RizonBNC, which has a rule that you have to be registered 7 days (1 week) before requesting a BNC, so I made a little script to get me the difference in between them.

Here’s the STDOUT on the shell

[email protected]:~$ ./time.rb -t "Aug 04 10:27:26 2016 MDT"
{:time=>"Aug 04 10:27:26 2016 MDT"}
Try again in 6 days, 23 hours, 24 minutes and 46 seconds (7 day wait)
[email protected]:~$ ./time.rb -n Blah -t "Aug 04 10:27:26 2016 MDT"
{:nick=>"Blah", :time=>"Aug 04 10:27:26 2016 MDT"}
Blah: Try again in 6 days, 23 hours, 24 minutes and 25 seconds (7 day wait)

Here’s the code, hosted on GitHub


  • If this page or post could use some sprucing up, let us know by contacting us through this link