Stories
Slash Boxes
Comments

SoylentNews is people

Log In

Log In

Create Account  |  Retrieve Password


exec irc bot api

Posted by crutchy on Saturday April 11 2015, @09:53AM (#1149)
0 Comments
Code

currently developing a sort of api for the exec irc bot.

bit of background: exec is run as a single php script process in a terminal, which connects to the soylent irc server, but when commands are triggered from the irc channels, the bot spawns child processes to service the commands. command aliases are mapped to shell commands using templates to substitute data from irc (such as nick, channel, message, etc). child processes are usually passed data using command line arguments, and communication to/from child processes and the bot process is facilitated through child process stdin and stdout pipes.
eg: typing "~rainbow ciri is a butthole" triggers the shell command: php scripts/rainbow.php 'ciri is a butthole'

the bot creates a named pipe and dumps a bunch of data to it in response to events, such as when a child process is started, when a message is received from a child process stdout pipe, when a message is received from the irc server, etc.
the named pipe can be read by something simple like cat, but i've written another php script to read it. this reader script also has a tcp socket server which allows yet another program to access the data stream (remotely even), such as telnet.
this is fine for just reading data, but i wanted to be able to command the bot remotely using this api. this is achieved by starting the reader script as a child process of the bot, which then offers the reader script the same methods taken advantage of normal scripts through stdin and stdout. a couple of specific stdout handlers were added to the bot script for acquiring specific data, but the reader also has direct access to irc and other functionality using existing stdout handlers (/IRC and /INTERNAL being the main handlers, used to output a raw message to the irc socket and perform an internal command respectively).
with two-way communication established between a tcp socket in the reader script and the main bot process, with event data streaming, i wanted to make a pretty gui application that i could see what is going on, since the bot terminal can be a bit crazy (each irc message can result in output filling half the terminal or more, due to internal events and data messages).
my tool of choice is delphi 7 pro, so i've made a little app called 'execstat' that connects to the reader socket server and reads the data streaming from it and enables commands to be sent. its pretty basic at this stage, but hope to develop it into something that i can use to easily see which scripts are running, which buckets are being get/set, which channels the bot is in, which commands are being triggered by who and where, etc. also important will be the ability to trigger kill commands for scripts, since currently to kill a script i have to go to a private channel, get a list of running processes (using the ~ps alias) and enter the pid in a ~kill alias command. not hard, but would be nice if i could just click a button in a gui. lazy++

the socket in the delphi app reads in its own thread, and uses a synchronized event handler to give data to the main application thread.

my current work revolves around rolling my own unserializer classes to parse the php serialized arrays, which is necessary to be able to get anything useful from the data streaming into the socket.

this whole setup is probably way overcomplicated and rediculous, but i enjoy working on it. moar_complexity++

Relationship Hacking: Part 5 - Hurry up and Wait!

Posted by Snow on Thursday April 09 2015, @09:26PM (#1146)
8 Comments
/dev/random

It's been roughly 3 months since my last entry, so I figured it's time for another update...

My wife and I have spent a lot of time over the last few months reading everything about non-monogamy that we could get our hands on. It's been pretty great actually because prior to that, we hadn't really read the same books before. I had earlier done a review of 'Opening Up', and that book really only scratched the surface of the whole poly thing. I have since read 'More Than Two', 'The Polyamorists Next Door' (which focuses more on poly with kids), and have recently started 'The Ethical Slut'.

These books go into much more detail on the actual workings of a poly relationship. Things like time management, being poly with kids, and dealing with stigma. It's been great to read the books, and then discuss them with my wife to see where we stand.

While both my wife and I have been addicted to learning all about poly, we still have no practical experience. It's all just theory at this point in time. We really just want something to happen.

I've been continuing my online search for women, with abysmal results. I've been trying to improve my look, with some success, but its had a negligible difference as far as the dating scene is concerned. It's honestly been very, very depressing for me, as mentioned in my previous journal entry. I've spent many, many hours viewing profiles and trying to think of good messages to send. 80% of them don't even respond, and 19% do respond but it doesn't go anywhere. I acknowledge that I am looking for a very, very specific person and so the odds are already stacked against me, but it's really hard not to take it personally.

Some days are worse than others (of course) and on the bad days when I'm moping around the house, my wife has been amazingly supportive and tries to pick me up. Without her, I would be dangerously depressed. I could go into a rant about online dating and the imbalance of power between the sexes, but I'll save that for another day.

I'm really all about equality in a relationship, and as such, my wife has the exact same liberties that I do. I would never have one set of rules for me, and another set of rules for her - she is also free to pursue extra relationships, and it's something that I would like to see her do. Thankfully for my sanity, she is not interested in pursuing on her own right now. She wants to see how things go with me first. If she was actively looking, I think it would pretty hard to see men lined up around the block while I get nothing but crickets. As I read more about polyamory, I realize that this is a pretty common problem for men.

In other news, my wife has had her IUD taken out and we have been doing natural birth control planning for the last couple months. Talking about a Baby or Poly has basically been the focus of our life for the last year. Lots, and lots of talk and theory, but nothing real yet, which is frustrating us both. We are both just really anxious for something to happen, and when it does, I'll post it here.

-- Snow

exec irc relay

Posted by crutchy on Saturday April 04 2015, @12:08PM (#1132)
1 Comment
Code

per previous journal i set up a simple channel relay feed to enable status messages for ncommander's nethack stream, but since there has been a little bit of talk about other games (including dungeon crawl stone soup) i turned the feed code into something more generic so that other feeds could be added easily. now there's feeds for the rodney bot from #nethack (freenode) to #nethack (soylent), as well as feeds for a couple of bots from ##crawl (freenode) to #crawl (soylent). the code to dispatch messages containing keywords has also been made generic, so that if ncommander plays again his deaths can be easily dispatched to #soylent for our amusement :p
code for this feature can be found here: https://github.com/crutchy-/exec-irc-bot/blob/master/scripts/activity.php#L86-L115

another feature that was briefly mentioned in my last journal has been developed further to enable limited two way communication between someone in a soylent irc channel and someone in a freenode irc channel.
to send a message to a channel on the freenode irc network (that an exec minion resides in with forwarding enabled) an authorized user on the soylent irc network in a channel with exec can type "#freenode_channel > message" and the message will be relayed. if you're in the freenode landing channel on the soylent irc network (#freenode) you'll be able to see any replies pop up in there, but it can easily get hidden amongst all the traffic from other channels, so to enable a 10 minute automated relay to a different soylent irc channel, type "#freenode_channel > freenode_nick, message" and for the next 10 minutes anything that freenode_nick says in #freenode_channel will be relayed to the originating soylent channel. only messages prefixed with "#freenode_channel >" will be relayed from soylent to freenode so soylentils can still talk without anyone on freenode hearing, but using the prefix on the soylent end (not required on freenode end) enables two-way communication. the relay lasts for 10 minutes, but can be easily renewed as many times as you want by typing another message (on soylent) in the form "#freenode_channel > freenode_nick, message". if you want to see a list of currently active relays, type ".relays" and it will list freenode_nick, freenode_channel, soylent channel and time remaining (in minutes). use of this feature is limited to a list of nickserv accounts.
code for this feature can be found here: https://github.com/crutchy-/exec-irc-bot/blob/master/scripts/activity.php#L133-L213

exec irc bot developments

Posted by crutchy on Friday April 03 2015, @09:20AM (#1128)
0 Comments
Code

re-enabled the ~submit alias so that instead of just pasting a link to irc, you can also (with smallest amount of additional effort) share it with SN users not on irc. syntax is really simple: ~submit %url%
just submits the description or og:description meta tag content along with the link, so makes for a pretty lame submission but its better than nothing at all (editors can always reject it if it sucks too much)

during NCommander's NetHack thing i tweaked the freenode relay script to output messages by the Rodney irc bot in the freenode #nethack channel to our #soylent channel when NCommander died in the game. also made it so that anything Rodney said was output to our local #nethack channel so that NetHack fans can see what's going on without connecting to freenode directly.

developed some macro functionality to enable authorized irc users to shorten otherwise long exec commands into shorter equivalents. came in handy for simplifying control of the freenode relay bot.
also made a compound macro (using exec's internal_macro lib function) to make it easy to talk through the relay bot from the SN irc channels to freenode channels.

we get a bit of spam occasionally in the wiki, and chromas is diligently blanking it out (despite not having authority to delete articles) as a means of spam control. a script has been developed to make it a little easier for him (and a couple of others in a list of authorized nickserv accounts). a spam page in the wiki can now be cleared with ".spamctl %page title%"

http://sylnt.us/exec
http://sylnt.us/execsrc

broke out ircd work into a separate github repo. currently working on ability to connect multiple times to a network with the same nick. idea is that if there are a few servers on the network you could connect to each of them, and then if one disconnects you can still use the other (redundant) connections. authentication of subsequent connections to the same nick is done using a connection id appended to the username field (username sent out doesn't include the connection id though).
the server is at a point where i can connect to it with hexchat a couple of times (server spits out a connection id on first connect, and i just paste that to the end of the username in second connection). i can then join a channel from either connection, which automatically joins for the other connection (weird to watch). then i can chat and the chat appears on both connections. its pretty funky to play with.
if the project goes anywhere (unlikely) it might be ideal to have a client that handles the redundant connections for you automatically rather than having to establish separate connections manually and have each one take up room in the server list. netsplits could be a thing of the past.
prolly will try to make it ts6 and rfc compatible, but still early stages.

https://github.com/crutchy-/ircd

April 1st, 2015

Posted by takyon on Thursday April 02 2015, @03:03AM (#1124)
0 Comments
/dev/random

A day that will live in e-fame-y.

Soylent Green

Posted by Gaaark on Wednesday April 01 2015, @12:42AM (#1122)
2 Comments
Reviews

Soylent green... i like the colour, but yeah it is hard on the eyes.

Happy April 1 people eating, everyone! :)

Brief inconsequential rant on behalf of H.P. Lovecraft

Posted by Yog-Yogguth on Monday March 30 2015, @04:54PM (#1119)
2 Comments
/dev/random

Today I lapsed in my local front of the ’War On Open Tabs (And Also Windows)’ (or ‘Woot(Aaw)’ for short) and from looking closer at ChipWhisperer-Lite detouring to EEVBlog and on to ESD (ElectroStatic Discharge) issues and Bill Beaty who tricked me into clicking onwards to ‘Vulture Central’ (The Register) where I ended up picking through the bones of the recent news of “Lost White City of the Monkey God Found After 500 Years” in which I came across a reference to a work of Lovecraft written 94 years ago which I didn't remember reading.

However it turned out I had read it under a different name, and on that same Wikipedia page once again yet another venerated authority was quoted slagging off HPL accusing him of being a “racist” or supremacist or anything else non-imaginative even though HPL had plainly explained what he was writing about or in response to (which was unimaginative shitty white village dramas).

At which point I wanted to congratulate E. F. Bleiler for picking through a dead man's brain in order to arouse himself and revel in the sticky glory of it. HPL would surely appreciate the combined or better yet unified necrophiliac morbidity and righteous “holy” bigoted megalomania of Bleiler's actions.

(And where else to offer my sarcastic approval than on my very own journal? Did I piss on his grave? I apologize but in my defense I can't be blamed for not noticing it on account of the latrine placed at the same spot by so many of his peers).

But yes for a while already E. F. Bleiler has been just as dead and if there's anything left after a few generations of macro and microfaunal procreation any maggots can continue his gruesome trade on his own brain :)

Now please excuse me as I make a few bookmarks for perusal in the eternity of time I do not have (and correct an index in an actual book) and close twenty or so tabs… the war must go on.

…and now I can't help but wonder what the world would be like if there was a Mr. and/or Mrs. Crowley-Lovecraft out there, and yes it has to be a double-barreled surname ;)

P.S. Happy Easter!

An Aberrant Sense of Right and Wrong

Posted by GungnirSniper on Wednesday March 25 2015, @02:56AM (#1100)
2 Comments
/dev/random

The Mighty Gewg has noted I am someone with an aberrant sense of right and wrong. Thanks for the complement, good sir. It is better to be the devil's advocate than a groupthinker.

SoylentNews IRC comments feed dispatch filters

Posted by crutchy on Saturday March 21 2015, @11:23PM (#1098)
0 Comments
Code

Our IRC (http://irc.sylnt.us/) has a #comments channel that you can join to see an hourly feed of all new comments that appear in reply to SoylentNews stories.

This has been around for a while, but over the weekend a new feature was added to allow more personalized comment feeds.

Filtered feeds can be dispatched either as a PM to your nick or to a channel of your choosing. To dispatch to a channel you just need to make sure the exec bot resides in that channel (you can command it to join by visiting #soylent and typing "~join #mychannel").

There are two types of filters; cid and pattern

The cid filter is useful if you would like a feed of all responses in a specific comment thread. You simply add a filter that points to the parent comment cid and the bot will feed all child comments that appear.

Using a pattern filter enables you to feed comments that meet certain criteria. There are a number of fields you can match, and any new comment that matches the criteria in a filter will be output to the target nick/channel.

You can add multiple filters to track multiple cid's and/or comments that match multiple patterns.

The following commands can be performed in any channel where the exec bot resides:

~comments filter-add %id% %target% %cid%
~comments filter-add %id% %target% %field% %pattern%
~comments filter-delete %id%
~comments filter-list

%id% = unique name to identify filter (cannot contain spaces)
%target% = channel or nick to send filtered comments to
%cid% = SoylentNews comment id to track ("cid" parameter in uri)
%field% = any of user, uid, score, score_num, subject, title, comment_body (title refers to the story title)
%pattern% = regexp pattern for use with preg_match (surrounding #'s are added by the script)

examples:
- if you wanted a feed for all replies to this comment: http://soylentnews.org/comments.pl?sid=6634&cid=160651
you would use this command:

~comments filter-add my_test_filter #mychannel 160651

- if you wanted a feed with any comments that contain "systemd" you could use this command:

~comments filter-add systemd_filter_1 #mychannel comment_body systemd

and if you also wanted comments with "systemd" in the subject, add another filter:

~comments filter-add systemd_filter_2 #mychannel subject systemd

--
source (unlicensed): https://github.com/crutchy-/exec-irc-bot/blob/master/scripts/comment_feed.php

Foggy/overcast 88.8% eclipse: not much (or any) difference

Posted by Yog-Yogguth on Friday March 20 2015, @10:30AM (#1095)
10 Comments
/dev/random

Title says it all really but I found it surprising that there wasn't much noticeable difference. It started out foggy but the fog had mostly risen to 100% low cloud cover at local eclipse maximum (88.8%) yet if I didn't know and someone told me there was an 88.8% eclipse at that moment I wouldn't have believed them at all. The level of light felt unexceptionally normal. It was more noticeable a while after the local maximum was over as it started to get a little bit brighter but for all purposes it was just like a normal variation caused by weather, no weird shadows, not even any streetlights turning themselves on.

It was so unnoticeable I double-checked the time of the event and my clock. I guess my eyes almost entirely compensated for the small and ever so gradual change. Right now it's not even supposed to be entirely over yet but meh :)

I slept through the last eclipse so maybe this is all completely normal, the lack of difference that is; me sleeping right through “events” is very normal :D