My name is Michael, but everyone calls me Mickle.
I live Oakland, grew up in Los Angeles.
I can not live without music. I am a musician, and play guitar.
I love meeting new people and developing friendships.
And I think there is nothing better than great company with a great meal and a couple of drinks.


Coins
, Name, Source, Tester, Status, Completed, Symbol, Name, rpcport, pubtype, taddr, p2shtype, wiftype, txfee, active, Json OP, Notes, Json Output:
1, Bitcoin, n41r0j, Completed, 24/ 07/ 2017, BTC, bitcoin, 8332, 0, 5, 128, 0,{" coin":" BTC"," name":" bitcoin","...


Join Social Boost and become a Booster!
Social Boost is a company formed by the YES Project to give 15-24 years olds not in education or employment, the experience and skills required to run their own social media company.
Your mission as a Booster:
- Learn how to use Social Media in a professional way
- Learn about the different platforms and gain tips and tricks
- Boost your entrepreneurial and sales skills
- Learn how to plan a Social Media campaign
- Take over the Social Media platforms for a real business
- Help a local business boost their social media presence.


Wrap serialized input in ActionController::Parameters
and use strong_parameters
to white-list variables when performing deserialization.
If the application receives input from an upstream component that specifies multiple attributes, properties, or fields that are to be initialized in an object, but it does not properly control which attributes can be modified, deserialization could be vulnerable to untrusted code revealing the serialized content.
Proper use of Action:Controller::Parameters
and strong_parameters
protects attributes from end-user assignment. By default, attributes are black-listed, and the developer chooses specific attributes to white-list for mass updating. Serialized object attributes which are not white-listed cannot be accidentally exposed or exploited by mass assignment.
During development and implementation, use features that allow specification of white lists of attributes or fields that are allowed to be modified.
Use the following steps to specify what user data can be exposed and assigned to variables.
Find all code that uses ActiveRecord to parse untrusted data. Search the code for use of ActiveRecord
with untrusted data deserialization. Make a list of these line numbers for your change control record.
Wrap untrusted data in ActionController::Parameters before parsing. Use ActionController::Parameters
to wrap the untrusted data.
Use strong_parameters to prevent mass assignment. White-list the untrusted data parameters with params.permit
.
Commit code changes. Commit the code changes and test the application. Make an entry in the change control record for the code updates.


# grid system
A simple grid system with 4 screen sizes (sm, md, lg, xl) build using Flex-box CSS3 prooperties & it based on bootstrap media query sizes to make your design responsive with maximum media resolutions
# Install
avaliable installing ways, choose one of them
- npm
npm install --save @mohssineaboutaj/grid-system
yarn add --save @mohssineaboutaj/grid-system
https://mohssineaboutaj.github.io/grid-system/css/grid-system.min.css
css/grid-system.css
or
css/grid-system.min.css
then follow usage steps bellow
NOTE: If you wanto to use npm or yarn you need to download Nodejs
# usage
-
Import css file
Note: dont forget to replace the PATH_OF_CSS_FILE with a real path of the css file<link rel="stylesheet" href=PATH_OF_CSS_FILE />
-
Use css classes

 size 6 columns in medium screens & up

 size 6 columns in medium screens & up

# browser support
this framework support any browser support the Flex-box properties, here is a table of the browsers supported
| # | browser | minimum version |
|---|---|---|
| chrome | 29 | |
| internet explorer | 11 | |
| firefox | 22 | |
| safari | 10 | |
| opera | 48 |
# basic grid
A basic columns usage with & without row wrapping
no wrapping
show 4 columns in every screen without any wrapping
column 1 of 4
column 2 of 4
column 3 of 4
column 4 of 4

column 1 of 4

column 2 of 4

column 3 of 4

column 4 of 4

with wrapping
show 4 columns in every screen with wrapping mode
column 1 of 4
column 2 of 4
column 3 of 4
column 4 of 4

column 1 of 4

column 2 of 4

column 3 of 4

column 4 of 4

# in one screen
make a special grid using -only suffix after your class
grid 3 in lg only & grid 6 in other screens
grid 3 in lg only & grid 6 in other screens
grid 3 in lg only & grid 6 in other screens
grid 3 in lg only & grid 6 in other screens

grid 3 in lg only & grid 6 in other screens

grid 3 in lg only & grid 6 in other screens

grid 3 in lg only & grid 6 in other screens

grid 3 in lg only & grid 6 in other screens


POINT OF NO RETURN A film review by David Pimmel Copyright 1993 David Pimmel
starring Bridget Fonda, Gabriel Byrne, Anne Bancroft, Dermot Mulroney, Harvey Keitel written by Robert Getchell directed by John Badham based on Luc Besson's 1991 film NIKITA, LA FEMME NIKITA in American release rated R for violence and such
Synopsis ========
Maggie (Bridget Fonda) is a very bad woman, killing a cop in a drugstore robbery. She is sentenced to death, but is rescued from this fate by Bob (Gabriel Byrne).  Always the pragmatist, Maggie joins up.
Review ======
I have not seen NIKITA, the film this is based on. So this review is of the film POINT OF NO RETURN as a stand alone film. I don't really want to go into a debate about whether or not this film should have been made or not. I also don't want to argue about which is better. As a stand alone film, I would recomment this film with some reservation. It has several very strong aspects, but also several that don't seem to work very well.
Bridget Fonda's performance is definitely the highlight of the film. I really didn't like her in SINGLE WHITE FEMALE, but here I think she taps into her genetic actor's roots. Particularly in the beginning, during her bad stage, her performance is very strong. In fact I thought that was the strongest part of the film. After she was fully trained and left the nest, I felt the quality of the film went down.
The primary reason for the drop was the Dermot Mulroney character. I found him to be an annoying bore who detracted from what was interesting to me, the relationship between Bob abd Maggie. He also seemed like a plot gimmick to show Maggie what life could be like if she weren't a professional assasin.
Rating ======
Thumbs Up! *** out of ****
--
David Pimmel<EMAIL_ADDRESS>.
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


[1] remote with little bit too reflective than ever heard.
[2] most unbelievable picture bevy of HDMI cable 's can customize the Harmony 890 that no universal capability is nobody looks at longevity esp CNET with little bit too reflective than ever heard.


Cantonese Food Review (Part 1)
Over the last few months in Guangzhou, China, I have had the opportunity to try some unique Cantonese food from all over the city. Some of them are well known dishes internationally, while some are rather exotic cuisine that are only popular locally. I will be introducing a few of them here in my blog from my personal tasting experience.
The first on the list is the famous "white cut chicken" (白切鸡). The marinated chicken is steamed, cut up, and served plain with the skin and bones. It is generally accompanied by an assortment of condiments, the most common and delicious one being the geung yung (姜蓉). It is a traditional Cantonese ginger paste made with ginger, minced garlic, scallions, salt, and hot oil. Other optional condiments include cilantro, peanuts, seaweed, and mushroom.
The next on the list is none other than the "braised pigeon" (红烧乳鸽). Contrary to its name, it is actually pigeon deep fried in seasoned oil until the exterior turns golden. What makes this dish one of my favorite Cantonese dishes of all time is that the pigeon smells incredibly aromatic, the skin is crispy and flavorful, and the meat tastes particular juicy and tender.
Now, we are gradually getting to food that are more exotic and perhaps even slightly peculiar to foreigners who are not familiar with Cantonese cuisine. One example of this is the "fish skin salad" (凉拌爽鱼皮) from the famous street food casual restaurant Chan Tim Kee (陈添记) located near Shangxiajiu (上下九) Pedestrian Street in the old town of Xiguan (西关). The skin from mud carp or dace fish is removed and frozen before mixing with peanuts, coriander, seasame, and soy sauce. It is an appetizing afternoon snack.
The "Pork offal" (猪杂) is an extremely common ingredient in Cantonese cuisine. You can find it in soups, stews, congees, noodles, steamed vermicelli rolls, rice, cooked alongside sauteed vegetables, or simply by itself. The picture above shows a popular way of preparing pork offals in many of Guangzhou's late night restaurants. The offals are fried on a sizzling hot pan with soy sauce, scallions, onions, and sliced ginger during the cooking process for seasoning purpose. It is also an excellent alcohol pairing.
Last but not least, the "double skin milk" (双皮奶), a famous Cantonese dessert made out of milk, egg whites, and sugar. It has a smooth taste similar to Italian milk custard although "double skin milk" is served hot. The name "double skin" comes from the fact that dessert is cooled twice, once after the milk is finished boiling, and again after addiing egg whites and sugar to allow the milk to curdle.
Thank you for reading my blog. Stay tuned for the next part where I will continue showcasing more delicious and iconic Cantonese food and drinks in the future.
Thank you, Ruida. Very cool!
This sounds great. I can't wait to try it!
That looks delicious, Ruida!


Buying and selling couldn't be simpler than this.
Live like the stars in these luxurious Southern California estates.
$1,900.00 /wk
Escape the cold and enjoy great weather without breaking the bank.
Experience Texas living in these awesome ranch-style homes.


When using the Externalizable interface, an externalizable object must implement a writeExternal method to save the state of the object and a readExternal method to restore the state of the object. The externalizable object must also coordinate with its supertype to save and restore its state.
This example demonstrates how an object saves and restores the state of its externalizable supertype. When the supertype of an externalizable object is also externalizable, the subclass object calls the writeExternal and readExternal methods of its superclass in its own writeExternal and readExternal methods.


This is what people think about Don Cherry scolding immigrants who don't wear poppies
by Sean Davidson, Multi-Platform Writer, CTV News TorontoDon Cherry is under fire for scolding immigrants who don’t wear poppies on national television.
The 85-year-old said on Saturday on his weekly Coach's Corner segment as part of Hockey Night in Canada that he's less frequently seeing people wearing poppies anymore to honour fallen Canadian soldiers.
He singled out those he believes are immigrants in Toronto, prompting a swift online backlash.
"You people ... you love our way of life, you love our milk and honey, at least you can pay a couple bucks for a poppy or something like that," Cherry said.

Many people outraged by the comments have called for Cherry to be fired, labelling him as a disgrace.
"I refuse to accept your anti-immigrant rhetoric on the @hockeynight platform," Shireen Ahmed wrote.
"It's time for Don Cherry to stop lecturing and start learning about the diverse and compassionate country we live in together," Toronto city councillor Josh Matlow wrote on Twitter.
“We are deeply grateful to our Veterans and welcome new Canadians with support and respect."
Mississauga mayor Bonnie Crombie also weighed in on Cherry's remarks, saying "new immigrants enrich our country."
"For @CoachsCornerDC to say that 'you people' do not respect or our veterans is despicable. We’re proud of diverse cultural heritage and we‘ll always stand up for it," Crombie tweeted.
Some people are defending Cherry, saying his controversial comments were "right on the money".
Ron MacLean, who hosts the segment with Cherry, took to Twitter to apologize for the way he handled the situation.
Meanwhile, Sportsnet president Bart Yabsley publically apologized for Cherry’s comments on Sunday morning. Yabsley says the network has spoken to Cherry about the severity of his comments.
"We have spoken with Don about the severity of this issue and we sincerely apologize for these divisive remarks," Yabsley said.
The National Hockey League also released a statement on Sunday afternoon, calling the comments "offensive".
"Hockey is at its best when it brings people together," the statement said.
"The comments made last night were offensive and contrary to the values we believe in."
With files from The Canadian Press.


controller module¶
-
class
controller.
Controller
(config)[source]¶ Bases:
object
-
ask
()[source]¶ Ask controller for the next hyperparameter search.
If Bayesian Optimizer, samples next hyperparameters by its internal statistic calculations (Random Forest Estimators, Gaussian Processes, etc.). If Random Search, samples randomly Based on ask-tell design pattern
- Returns:
- list: list of hyperparameters
-
init_random_search
()[source]¶ Initializes random search as the search space is list of random functions
-
init_skopt
(opt_initial_points)[source]¶ Initialize as scikit-optimize (skopt) Optimizer with a 5-dimensional search space
Aligned with skopt ask-tell design pattern (https://geekyisawesome.blogspot.com/2018/07/hyperparameter-tuning-using-scikit.html)
- Args:
- opt_initial_points (int): number of random initial points for the optimizer
-
opt
= None¶
-
random_search_space
= None¶
-
tell
(trial_hyperparams, f_val)[source]¶ Tells the controller result of previous tried hyperparameters
If Bayesian Optimizer, records this results and updates its internal statistical model. If Random Search does nothing, since it will not affect future (random) samples.
- Args:
- trial_hyperparams (list): list of tried hyperparamters f_val (float): trial cost
-


SAIKIRAN TALLAPANENI |
PERSONAL INFORMATION :Hey folks.. This is Kiran basically from Nellore, Andhrapradesh, India. Beacuse of my fathers business, we settled in the beautiful green city BANGALORE.  EDUCATIONAL QUALIFICATIONS :I did all my schooling in my Nellore and passed the high school with distinction. I finished my pre university withe the percentage of 90%. Then I joined in an esteem college for my bachelors in the department of Computer science. I completed my bachelors in the field of computer science in the year 2013.
WORK EXPERIENCE :I worked for a multinational company
CAPGEMINI as a developer. I got trained intensely in
|


New released variant on this Extension is protecting your Privacy by prevent track fbclid parameter.
Install here: Kill fbclid PLUS


Home
Pages
Classes
Methods
Pages
README
Class and Module Index
ApplicationController
ApplicationHelper
ArchiveController
ArchiveHelper
Attachment
AttachmentsController
AttachmentsHelper
Attendee
AttendeesController
AttendeesHelper
CalendarInvite
Environment
Event
EventMailer
EventStyle
EventTypes
EventsController
EventsHelper
FinalizeEventMailer
Host
LabsController
LabsHelper
LunchAndLearnHelper
Lunchlearn
LunchlearnsController
LunchlearnsHelper
Notification
NotificationsController
NotificationsHelper
Object
Profile
ProfilesController
ProfilesHelper
Referral
ReferralsController
ReferralsHelper
Schedule
SendReferralMailer
Session
Skytap
Skytap::ClassMethods
Skytap::InstanceMethods
Suggestion
SuggestionsController
SuggestionsHelper
Survey
SurveyEndMailer
SurveyMailer
SurveysController
SurveysHelper
Template
TrainingClass
User
UserEmail
UsersController
UsersHelper
Webinar
WebinarsController
WebinarsHelper
WeeklyMailer
WelcomeController
WelcomeHelper
This is the API documentation for Rails Application Documentation.


The Hunchback of Notre Dame
by Victor Hugo
Book Tenth, Chapter 7
Additional Information
- Year Published: 1831
- Language: English
- Country of Origin: France
- Source: Hapsgood, I., trans. (1831). The Hunchback of Notre Dame. New York: Carey, Lea, and Blanchard.
-
Readability:
- Flesch–Kincaid Level: 12.0
- Word Count: 745
- Genre: Romance
- Keywords: culture, fate, love, loyalty
- ✎ Cite This
Downloads
The reader will, perhaps, recall the critical situation in which we left Quasimodo. The brave deaf man, assailed on all sides, had lost, if not all courage, at least all hope of saving, not himself (he was not thinking of himself), but the gypsy. He ran distractedly along the gallery. Notre–Dame was on the point of being taken by storm by the outcasts. All at once, a great galloping of horses filled the neighboring streets, and, with a long file of torches and a thick column of cavaliers, with free reins and lances in rest, these furious sounds debouched on the Place like a hurricane,—
"France! France! cut down the louts! Châteaupers to the rescue! Provostship! Provostship!"
The frightened vagabonds wheeled round.
Quasimodo who did not hear, saw the naked swords, the torches, the irons of the pikes, all that cavalry, at the head of which he recognized Captain Phoebus; he beheld the confusion of the outcasts, the terror of some, the disturbance among the bravest of them, and from this unexpected succor he recovered so much strength, that he hurled from the church the first assailants who were already climbing into the gallery.
It was, in fact, the king's troops who had arrived. The vagabonds behaved bravely. They defended themselves like desperate men. Caught on the flank, by the Rue Saint– Pierre–aux–Boeufs, and in the rear through the Rue du Parvis, driven to bay against Notre–Dame, which they still assailed and Quasimodo defended, at the same time besiegers and besieged, they were in the singular situation in which Comte Henri Harcourt, ~Taurinum obsessor idem et obsessus~, as his epitaph says, found himself later on, at the famous siege of Turin, in 1640, between Prince Thomas of Savoy, whom he was besieging, and the Marquis de Leganez, who was blockading him.
The battle was frightful. There was a dog's tooth for wolf's flesh, as P. Mathieu says. The king's cavaliers, in whose midst Phoebus de Châteaupers bore himself valiantly, gave no quarter, and the slash of the sword disposed of those who escaped the thrust of the lance. The outcasts, badly armed foamed and bit with rage. Men, women, children, hurled themselves on the cruppers and the breasts of the horses, and hung there like cats, with teeth, finger nails and toe nails.  Others thrust iron hooks into the necks of the cavaliers and dragged them down. They slashed in pieces those who fell.
One was noticed who had a large, glittering scythe, and who, for a long time, mowed the legs of the horses. He was frightful. He was singing a ditty, with a nasal intonation, he swung and drew back his scythe incessantly. At every blow he traced around him a great circle of severed limbs. He advanced thus into the very thickest of the cavalry, with the tranquil slowness, the lolling of the head and the regular breathing of a harvester attacking a field of wheat. It was Chopin Trouillefou. A shot from an arquebus laid him low.
In the meantime, windows had been opened again. The neighbors hearing the war cries of the king's troops, had mingled in the affray, and bullets rained upon the outcasts from every story. The Parvis was filled with a thick smoke, which the musketry streaked with flame. Through it one could confusedly distinguish the front of Notre–Dame, and the decrepit Hôtel–Dieu with some wan invalids gazing down from the heights of its roof all checkered with dormer windows.
At length the vagabonds gave way. Weariness, the lack of good weapons, the fright of this surprise, the musketry from the windows, the valiant attack of the king's troops, all overwhelmed them. They forced the line of assailants, and fled in every direction, leaving the Parvis encumbered with dead.
When Quasimodo, who had not ceased to fight for a moment, beheld this rout, he fell on his knees and raised his hands to heaven; then, intoxicated with joy, he ran, he ascended with the swiftness of a bird to that cell, the approaches to which he had so intrepidly defended. He had but one thought now; it was to kneel before her whom he had just saved for the second time.
When he entered the cell, he found it empty.


Below, please enter in the URL for the website you would like to check.
This application uses Google's Safe Links to help a user determine if a website is safe to go to or not. These are only to be taken as suggestions as attack websites are constantly changing. Always use your best judgement to determine if you should be on a website or not.


Class GameExtensions
Inheritance
System.Object
GameExtensions
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: PacManBot.Extensions
Assembly: Pacman.dll
Syntax
public static class GameExtensions
Methods
| Improve this Doc View SourceFindLines<T>(Board<T>, T, Int32, List<Pos>)
Finds all horizontal, vertical, and diagonal lines consisted of values equal to the specified value, inside a board.
Declaration
public static bool FindLines<T>(this Board<T> board, T value, int length, List<Pos> result = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Board<T> | board | The board to find lines in. |
| T | value | The value to find lines of. |
| System.Int32 | length | The required minimum length. Lines exceeding this length will only be counted once. |
| System.Collections.Generic.List<Pos> | result | The list where the positions of found lines will be stored, if provided. |
Returns
| Type | Description |
|---|---|
| System.Boolean | Whether any lines were found. |
Type Parameters
| Name | Description |
|---|---|
| T |
Remarks
To be used in games such as Tic-Tac-Toe and Connect 4.
GameFile(IStoreableGame)
A stored game's unique filename based on its type and identifying ID.
Declaration
public static string GameFile(this IStoreableGame game)
Parameters
| Type | Name | Description |
|---|---|---|
| IStoreableGame | game |
Returns
| Type | Description |
|---|---|
| System.String |
IdentifierId(IBaseGame)
The unique id that identifies a game, which can be its owner's user ID or the housing channel's ID depending on the type.
Declaration
public static ulong IdentifierId(this IBaseGame game)
Parameters
| Type | Name | Description |
|---|---|---|
| IBaseGame | game |
Returns
| Type | Description |
|---|---|
| System.UInt64 |
Opposite(Dir)
Returns the opposite direction to the one provided.
Declaration
public static Dir Opposite(this Dir dir)
Parameters
| Type | Name | Description |
|---|---|---|
| Dir | dir |
Returns
| Type | Description |
|---|---|
| Dir |
ToPos(Dir, Int32)
Converts a direction into a Pos vector with the given length.
Declaration
public static Pos ToPos(this Dir dir, int length = 1)
Parameters
| Type | Name | Description |
|---|---|---|
| Dir | dir | |
| System.Int32 | length |
Returns
| Type | Description |
|---|---|
| Pos |


PP Forms
PP Forms
Bill start date
Required
Invalid Format
Bill end state
Bill usage
Required
Less than 10
Larger than 0
Result: {{ bill | json }}


Akshay's Personal Website
Home
About Me
Work Experience
Extra Curriculars
Contact Me
×
Warning!
Please limit your query to 200 words! :)
Name
Email address
Query
File input
Example block-level help text here.
Check me out
Submit


Dashboard
Home
Dashboard
Product A Sales
Montly
20.40%
Daily
5.40%
Product B Sales
Montly
20.40%
Daily
5.40%
Product C Sales
Montly
20.40%
Daily
5.40%
Sales Overview
Ample Admin Vs Pixel Admin
Ample
Pixel
Product Sales
Mobile
Desktop
Tablet
Download count
March 2017
35487
New Delhi
Sunday 15 march
32
0
Sunny Rainy day
25
0
Tonight
Product Overview
Customer
Photo
Quantity
Date
Status
Actions
Steave Jobs
20
10-7-2017
Paid
Varun Dhavan
25
09-7-2017
Pending
Ritesh Desh
12
08-7-2017
Paid
Hrithik
18
02-7-2017
Failed
Earning
Andrew
$2300
Kristeen
$3300
Dany John
$4300
Chris gyle
$5300
Prabhas
$4567
Bahubali
$7889
Discount
25th Jan
Now Get
50% Off
on buy
- Ecommerce site
25th Jan
Now Get
50% Off
on buy
- Ecommerce site
25th Jan
Now Get
50% Off
on buy
- Ecommerce site
Monthly Wineer
Hanna Gover
Accoubts Manager Amix corp
254
54
New items
Brand New Chair
Brand New Chair
Brand New Chair
Brand New Chair


--- published: true layout: post headline: "Bringing Guantanamo Home" maintitle: "Bringing Guantanamo Home - {Young}ist" tagline: undefined excerpt: "Bringing Guantanamo Home" categories: - article tags: - war - incarceration - prisons - art featuredphoto: http://31.media.tumblr.com/27f6684b759409822aa2bde8b6b47d51/tumblr_mob71hyn561sp5io1o1_1280.jpg featuredphotoalttext: "a young man sits on a couch watching tv; behind him is a person standing in an orange jumpsuit with a black hood over their head. text reads: 'silence can be violence #closeguantanamonow'" contributors: - Nic Eaton contributorphoto: https://scontent-a-lga.xx.fbcdn.net/hphotos-frc1/t31/q71/s720x720/1404761_10152337492313508_475129459_o.jpg contributorshortbio: undefined contributortwitter: TalkLabor contributorage: 1/1/1989 ---
By Nic Eaton Special thanks to Jess Turturro, Constantine Tziovaras and Witness Against Torture. 117 days of hunger, 166 prisoners. While Twitter and Facebook repeat the refrain, even the most conscious of us can start to see numbers rather than people. The struggle to shut down Guantanamo Bay (and other torture black sites like it) has been going on well before I took an active role. Countless heroes have dedicated their time and energy to bringing the reality of Guantanamo to the streets of the United States - internalizing this atrocity and domesticating the problem. As my roommate and I donned the orange jumpsuit and hood, our privilege became astoundingly clear. We could take off the jumpsuit. We could adjust the hood. We could come and go as we pleased. We were not imprisoned, tortured, ridiculed or harassed. We could see our friends and families and we could sleep without nightmares.  Resolve yourself to lift them up and walk beside them or resign yourself to contributing to their endless suffering. Nic Eaton is a labor organizer and member of the Organization for a Free Society. Follow him at @TalkLabor'


Model end users¶
A model end user runs a composed model, but changes neither model components nor the composition of model components. The model end user only creates and works with the run file of the model.
If you want to know how to create your own model, read the model composers tutorial. If you want to know how to create new model components, read the model component developers tutorial.
Starting point for a model end user is the runfile template and the API documentation of the model at hand. Using the documentation the model end user sets parameters, instantiates the necessary entities and taxa passing the appropriate arguments and iterates the model using the runner. The output trajectory of the runner is ready for data analysis and plotting.
This tutorial guides the reader through these steps using the seven dwarfs model.
Starting point of the seven dwarf model: a fairy tale¶
Once upon a time in a place far away seven dwarfs lived together in a cave. Winter had come and they could not leave their cave to collect food. They grew older and were to die, either from age or from hunger.
Their beards grew longer and the only thing giving them a glimpse of hope in their pitiful lives was an old story of a beautiful princess that would arrive some day and save them from their misery. When Snow White finally arrived she tricked them, ate half of their food supplies and left them to die.
Creating a Runfile¶
This fairy tale was already transformed into the model components seven_dwarfs
and snowwhite
and
the composed model seven dwarfs
. Creating a copy of the template
runfile, we complete our runfile by executing the following steps.
Importing packages¶
At first, we import the necessary packages. Besides ordinary python packages needed for data analysis and plotting,
we import the seven dwarfs model from pycopancore.models
and the runner from pycopancore.runners
.
import numpy as np
from time import time
import datetime as dt
import plotly.offline as py
import plotly.graph_objs as go
import pycopancore.models.seven_dwarfs as M
from pycopancore.runners.runner import Runner
Setting of parameters¶
Secondly, we set the parameters of our model, including the time interval of our simulation, the time step, the number of dwarfs and the eating stock:
# setting timeinterval for run method 'Runner.run()'
timeinterval = 100
# setting time step to hand to 'Runner.run()'
timestep = .1
nc = 1 # number of caves
dwarfs = 7 # number of dwarfs
Instantiating Entities and Taxa¶
Afterwards, we instantiate the model as well as its entities and taxa. In the seven dwarfs example, the entities
World
and Cell
need some required keyword arguments. We collect these information by checking the entities and taxa in the
API documentation.
model = M.Model()
# instantiate process taxa culture:
# In this certain case we need 'M.Culture()' for the acquaintance network.
culture = M.Culture()
# instantiate world:
world = M.World(culture=culture)
# instantiate cells (the caves)
cell = [M.Cell(world=world,
eating_stock=100
)
for c in range(nc)
]
Instantiating the Runner¶
Upon instantiation of the runner, we need to pass the model object to the runner. It is possible to pass a list of termination calls which comprise constraints defining under which circumstances the model run should stop. The termination calls must be provided by an entity or a taxon of the model.
start = time()
print("done ({})".format(dt.timedelta(seconds=(time() - start))))
print('\n runner starting')
# Define termination signals as list [ signal_method, object_method_works_on ]
# the termination method 'check_for_extinction' must return a boolean
termination_signal = [M.Culture.check_for_extinction,
culture]
# Define termination_callables as list of all signals
termination_callables = [termination_signal]
# Runner is instantiated
r = Runner(model=model,
termination_calls=termination_callables
)
Simulating¶
Now, all necessary objects required for a model run are instantiated. We set the start time and use the method run
of the runner to start the simulation. The method returns the model trajectory as a python dictionary.
start = time()
# run the Runner and saving the return dict in traj
traj = r.run(t_1=timeinterval, dt=timestep)
runtime = dt.timedelta(seconds=(time() - start))
print('runtime: {runtime}'.format(**locals()))
Analysing the Output and Plotting¶
The structure of the trajectory is traj[M.Entity.Variable][Entity_number]
and comprises a list of variable values
for every time step. The acquired data may be analysed and plotted.


Covid-19 TrialsTracker
Tracking COVID-19 Trials and their Results
Full Data
Results
Interactive
Figures
About


Background
This project was a culmination of various different analysis techniques learned in the class: “Quantitative Engineering Analysis”.  Using 2D LIDAR information and wheel encoder odometry, we attempted to navigate and map a closed loop course denoted by a series of plastic cups. Below is a gif demonstrating the robot, and some of the analysis it does in action!
How it works
This project utilized a bunch of really cool analysis techniques. The robot first took a scan of the environment, and then using a cluster detection and feature extraction algorithm that I wrote, we were able to determine the location of cup relative to the robot. The robot then used the encoder information to translate and rotate the points that it scanned into the global coordinate system. Then, using a Bayesian correspondence detector that I developed, we were able to determine which points corresponded to new cups, and which points corresponded to previously observed cups. Finally, using my implementation of the Iterative Closest Points algorithm, we were able to finely reconcile the information contained in the new scan, with the existing global map, and line up corresponding points as best as possible. More information can be found in our final report
Gallery
This project produced some pretty cool images and figures, which are shown off below
The first state of incoming LIDAR information. This is just raw, unfiltered 2D point clusters
The first stage of cluster detection is filtering out points that are simply too far away to get an accurate reading of. Points of potential interest are highlighted here in red
This figure shows actual cluster detection happening. Different clusters are identified based on variance in the distance between neighboring points.
This figure shows feature extraction once cluster detection is performed. Clusters that are circular and roughly the same size as cones are abstracted to their geometric centers, represented here by black asterisks.
This figure shows the relative likelihood of an old cup in any given location given the locations of currently known cups on the top. On the bottom, the figure shows the relative likelihood of a new cup in any given location given the locations of currently known cups. Super-imposed on each plot is a picture of the physical set up. The third cone was not picked up by the LIDAR sensor, but the algorithm is smart enough to know where there is likely a cup.
A look at a developed likelihood distribution gradient and global map of previously observed cups.


Preparation time
less than 30 mins
Cooking time
30 mins to 1 hour
Serves
Serves 4
Dietary
Equipment: You will need a 10 inch (25 cm) frying pan and the oven pre-heated to its lowest setting.
First of all chop the mushrooms into roughly 1 inch (2.5 cm) chunks - it's going to look an enormous quantity at this stage, but they will lose approximately half their volume in the initial cooking. Now heat a teaspoon of the olive oil in a frying pan and, when it's hot, throw in the mushrooms and toss them around by shaking the pan. Don't worry that there is so little oil, because the mushrooms give off masses of juice once the heat gets to them. Season with salt and pepper, then turn the heat down to very low and just let the mushrooms cook gently, uncovered, so that all the juice evaporates and the flavour of the mushrooms becomes more concentrated. Leave them like that for 30 minutes, stirring them around once or twice.
While they are cooking, cut two-thirds of the cheese into ¼ inch (5mm) cubes and grate the other third on the coarse blade of the grater. After that, break the eggs into a large bowl, whisk lightly with a fork and season well with salt and pepper. Then add three-quarters of the cooked mushrooms to the eggs, together with the cubed cheese. Place the rest of the mushrooms in a bowl covered with foil and keep them warm in the oven, along with the plates.
Now wipe the pan clean with some kitchen paper and put it back on a medium heat, add the rest of the olive oil and, when it's hot, swirl it around the pan. Turn the heat down to its lowest setting and pour the egg mixture into the pan, scattering the grated cheese all over the surface. Now all you have to do is leave it alone and put a timer on forminutes.
When 15 minutes have passed, turn the grill on to its highest setting and see how the omelette is cooking - it will probably take about 20 minutes in total to cook, but there should still be about 10 per cent of liquid egg left on the top. At that stage transfer the pan to the grill - not too close - and cook briefly to allow the liquid egg to set. This will take 20-30 seconds. Scatter the remaining cooked mushrooms over the top of the frittata and cut it into four wedges. Transfer the wedges to warm plates and serve immediately, because the egg will continue cooking even though the frittata is no longer in contact with the heat. I like to serve this with two salads - a plain, green lettuce salad and a tomato and basil salad.


About
Hey there, I'm Héctor, a software engineer at Facebook. I am a mobile app developer at heart, and for the past four years I've worked as a developer advocate for Parse, the backend as a service for mobile that recently transitioned to an open source Parse Server. I am now exploring new ways of building native apps with a focus on improving developer efficiency.
I live in the San Francisco Bay Area with my wife and young son. We have been here for a few years now, but I was born and grew up in Puerto Rico, a colonial territory of the United States.
After graduating from the University of Puerto Rico Mayagüez with a B.S. in Computer Engineering, I worked as a Systems Architect for several years at EVERTEC, a transaction processing business serving major financial institutions in Latin America. I quit my first job out of college to develop mobile applications full time, eventually building what is still the #1 mobile app in Puerto Rico.
Appearances
- Ask Parse Anything - JavaScript and Cloud Code Tips - Facebook, Menlo Park, CA
- Ask Parse Anything - July 2015 - Facebook, Menlo Park, CA
- Ask Parse Anything - May 2015 - Facebook, Menlo Park, CA
- The Next Level: Building Complex Apps on Parse - Facebook F8 2015, San Francisco, CA
- Facebook F8 2014 App
- Getting Started With Parse - Parse Developer Day 2013, San Francisco, CA
- Getting Started with Parse - Facebook Mobile Developer Conference 2013, London, U.K.
Employers
- Facebook - Platform Services Engineer, Developer Infrastructure
- Parse - Solutions Architect, Developer Advocacy
- Polsense - Principal Engineer
- EVERTEC - Systems Architect, Senior Engineer
- Xerox - Internship, Continuous Build Systems
- UPR Mayagüez - Systems Administrator for the Physics Dept. Computer Lab and High Performance Cluster
Elsewhere
- Twitter: @hectorramos
- Instagram: hramos


| scale_colour_steps {ggplot2} | R Documentation |
Binned gradient colour scales
Description
scale_*_steps
creates a two colour binned gradient (low-high),
scale_*_steps2
creates a diverging binned colour gradient (low-mid-high),
and scale_*_stepsn
creates a n-colour binned gradient. These scales are
binned variants of the gradient scale family and
works in the same way.
Usage
scale_colour_steps(
...,
low = "#132B43",
high = "#56B1F7",
space = "Lab",
na.value = "grey50",
guide = "coloursteps",
aesthetics = "colour"
)
scale_colour_steps2(
...,
low = muted("red"),
mid = "white",
high = muted("blue"),
midpoint = 0,
space = "Lab",
na.value = "grey50",
guide = "coloursteps",
aesthetics = "colour"
)
scale_colour_stepsn(
...,
colours,
values = NULL,
space = "Lab",
na.value = "grey50",
guide = "coloursteps",
aesthetics = "colour",
colors
)
scale_fill_steps(
...,
low = "#132B43",
high = "#56B1F7",
space = "Lab",
na.value = "grey50",
guide = "coloursteps",
aesthetics = "fill"
)
scale_fill_steps2(
...,
low = muted("red"),
mid = "white",
high = muted("blue"),
midpoint = 0,
space = "Lab",
na.value = "grey50",
guide = "coloursteps",
aesthetics = "fill"
)
scale_fill_stepsn(
...,
colours,
values = NULL,
space = "Lab",
na.value = "grey50",
guide = "coloursteps",
aesthetics = "fill",
colors
)
Arguments
... |
Arguments passed on to binned_scale
n.breaks The number of break points to create if breaks are not given
directly.
nice.breaks Logical. Should breaks be attempted placed at nice values
instead of exactly evenly spaced between the limits. If TRUE (default)
the scale will ask the transformation object to create breaks, and this
may result in a different number of breaks than requested. Ignored if
breaks are given explicetly.
right Should values on the border between bins be part of the right
(upper) bin?
show.limits should the limits of the scale appear as ticks
name The name of the scale. Used as the axis or legend title. If
waiver() , the default, the name of the scale is taken from the first
mapping used for that aesthetic. If NULL , the legend title will be
omitted.
breaks One of:
-
NULL for no breaks
-
waiver() for the default breaks computed by the
transformation object
A numeric vector of positions
A function that takes the limits as input and returns breaks
as output (e.g., a function returned by scales::extended_breaks() )
labels One of:
-
NULL for no labels
-
waiver() for the default labels computed by the
transformation object
A character vector giving labels (must be same length as breaks )
A function that takes the breaks as input and returns labels
as output
limits One of:
-
NULL to use the default scale range
A numeric vector of length two providing limits of the scale.
Use NA to refer to the existing minimum or maximum
A function that accepts the existing (automatic) limits and returns
new limits
Note that setting limits on positional scales will remove data outside of the limits.
If the purpose is to zoom, use the limit argument in the coordinate system
(see coord_cartesian() ).
oob One of:
expand For position scales, a vector of range expansion constants used to add some
padding around the data to ensure that they are placed some distance
away from the axes. Use the convenience function expansion()
to generate the values for the expand argument. The defaults are to
expand the scale by 5% on each side for continuous variables, and by
0.6 units on each side for discrete variables.
trans For continuous scales, the name of a transformation object
or the object itself. Built-in transformations include "asn", "atanh",
"boxcox", "date", "exp", "hms", "identity", "log", "log10", "log1p", "log2",
"logit", "modulus", "probability", "probit", "pseudo_log", "reciprocal",
"reverse", "sqrt" and "time".
A transformation object bundles together a transform, its inverse,
and methods for generating breaks and labels. Transformation objects
are defined in the scales package, and are called <name>_trans (e.g.,
scales::boxcox_trans() ). You can create your own
transformation with scales::trans_new() .
position For position scales, The position of the axis.
left or right for y axes, top or bottom for x axes.
super The super class to use for the constructed scale
|
low |
Colours for low and high ends of the gradient.
|
high |
Colours for low and high ends of the gradient.
|
space |
colour space in which to calculate gradient. Must be "Lab" -
other values are deprecated.
|
na.value |
Colour to use for missing values
|
guide |
Type of legend. Use "colourbar" for continuous
colour bar, or "legend" for discrete colour legend.
|
aesthetics |
Character string or vector of character strings listing the
name(s) of the aesthetic(s) that this scale works with. This can be useful, for
example, to apply colour settings to the colour and fill aesthetics at the
same time, via aesthetics = c("colour", "fill") .
|
mid |
colour for mid point
|
midpoint |
The midpoint (in data value) of the diverging scale.
Defaults to 0.
|
colours |
Vector of colours to use for n-colour gradient.
|
values |
if colours should not be evenly positioned along the gradient
this vector gives the position (between 0 and 1) for each colour in the
colours vector. See rescale() for a convenience function
to map an arbitrary range to between 0 and 1.
|
colors |
Vector of colours to use for n-colour gradient.
|
Details
Default colours are generated with munsell and
mnsl(c("2.5PB 2/4", "2.5PB 7/10"))
. Generally, for continuous
colour scales you want to keep hue constant, but vary chroma and
luminance. The munsell package makes this easy to do using the
Munsell colour system.
See Also
scales::seq_gradient_pal()
for details on underlying
palette
Other colour scales:
scale_alpha()
,
scale_colour_brewer()
,
scale_colour_gradient()
,
scale_colour_grey()
,
scale_colour_hue()
,
scale_colour_viridis_d()
Examples
df <- data.frame(
x = runif(100),
y = runif(100),
z1 = rnorm(100)
)
# Use scale_colour_steps for a standard binned gradient
ggplot(df, aes(x, y)) +
geom_point(aes(colour = z1)) +
scale_colour_steps()
# Get a divergent binned scale with the *2 variant
ggplot(df, aes(x, y)) +
geom_point(aes(colour = z1)) +
scale_colour_steps2()
# Define your own colour ramp to extract binned colours from
ggplot(df, aes(x, y)) +
geom_point(aes(colour = z1)) +
scale_colour_stepsn(colours = terrain.colors(10))
[Package
ggplot2 version 3.3.3
Index]


A normal dice has 6 sides.
The following are types & images of Dice.
   Click roll to play & hold to pass on.
HINT: Roll until it says, your turn is over.
Mine is a two player game.
Each player to ENTER his/her name.
Kindly follow the rules.
ENJOY PLAYING!
Round Total:
Total Score:
Round Total:
Total Score:


Supernovae is an event when a star at the end of its life colapses onto itself and creates a big explodes. The planets are heavenly bodies which were formed from the supernovae. Some of the big chunks merged to form bigger planets while some formed dwarf planets and some formed the Asteroid and Kuiper Belts. Here is a description on each of the planets.
|
|
|
|
Time taken for the sunlight to reach | Rotation Time | Revolution Time | Diameter | Mass | Distance from the sun | Number of Earths which can fit | Surface Temprature |
| Mercury | 0 | 3.2 Minutes | 55 days 15 hours 30 Minutes | 88 Earth Days | 4879.4 km | 3.285 x 10^23 kg | 66.162 million km | 1/18 Earths | 800 degree faraniet | |
| Venus | 0 | 6 Minutes | 116d 18h | 225 Days | 12,104 km | 4.867 x 10^24 kg | 108.53 million km | 9/10 Earths | 900 degree faraniet | |
| Earth | 1 | 8 Minutes | 24h | 365.25 Days | 12,742 km | 5.972 x 10^24 kg | 151.26 million km | 1 | 58.62 degree faraniet | |
| Mars | 2 | 12.5 Minutes | 1.03 Days | 1.88 years | 6,779 km | 6.39 x 10^23 kg | 249.38 million km | 1/2 Earths | -80 degree faraniet | |
| Jupiter | 79 | 43 Minutes | 10 hours | 12 years | 139,820 km | 1.898 x 10^27 kg | 751.95 million km | 1300 | 234 degree faraniet | |
| Saturn | 82 | 79.3 Minutes | 0.45 Days | 29.46 years | 116,460 km | 5.683 x 10^26 kg | 1.434 Billion Km | 764 | -288 degree faraniet | |
| Uranus | 27 | 2 hours and 40 minutes | 0.72 Days | 84.01 years | 50,724 km | 8.681 x 10^25 kg | 2.9526 billion km | 63 | -353 degree faraniet | |
| Neptune | 14 | 4 hours | 0.67 days | 164.79 years | 49,244 km | 1.024 x 10^26 kg | 4.4752 billion km | 57 | -392 degree faraniet |
Click on the bold words to know more about them


Weightless is the lowest barrier-to-entry database mapping library for the JVM. Weightless currently supports MongoDB.
Create Database Records
A great place to start with the Weightless library.
Press the green play button at the top of the Repl.it below to begin the first example.
Search for Database Records
Searching a database is extremely easy with Weightless because it conforms to the wrapper types you want to return (such as List or Iterator).
Update Database Records
Updating records is just as simple as you might expect.
Delete Database Records
Deleting database records is just as natual as finding them.
Weightless with a Webserver
This example shows how weightless can be used to serve data behind a simple Javalin webserver.
Installation
Install with maven:
<dependency>
<groupId>com.jackhallam</groupId>
<artifactId>weightless-orm</artifactId>
<version>0.1.1-beta</version>
</dependency>


UST tablenetters head straight to UAAP finals
by Manila Standard SportsUniversity of Santo Tomas jumped straight to the Finals of the UAAP Season 82 Men’s Table Tennis Tournament after completing a 14-0 elimination sweep Monday at the Blue Eagle Gym.
The Tiger Paddlers scored a 3-0 romp of University of the Philippines before returning in the afternoon session with a 3-1 victory over National University.
UST remains on course of winning back-to-back and a record 28th crown.
Despite losing twice in the final day of the eliminations, the Bulldogs (11-3) will still have the twice-to-beat bonus in the step-ladder semifinals for being ranked No. 2.
NU suffered a shock 2-3 loss to Adamson University in the morning session.
De La Salle finished strong in the eliminations after identical 3-0 wins over Ateneo and University of the East.
The Falcons then tied with the Green Paddlers at 9-5 following a 3-0 tripping of the Blue Eagles.
De La Salle and Adamson University clash in a do-or-die tie at 9 a.m. Tuesday. The winner will face the Bulldogs at 1 p.m. Tuesday.
The best-of-three Finals will be played on Wednesday starting at 9 a.m.
Meanwhile, back-to-back title-seeking University of Santo Tomas avenged its lone loss of the season with a 3-1 conquest of Ateneo Monday at the Blue Eagle Gym.
The Tigress Paddlers swept the second round of the eliminations and finished with a league-best 13-1 record.
UST, which defeated University of the East, 3-0, earlier in the day, will face Far Eastern University in the Final Four at 9 a.m. on Tuesday.
Ateneo stunned De La Salle, 3-0, in a playoff to secure the remaining twice-to-beat slot in the Final Four. The vastly-improved Lady Eagles and the Lady Paddlers ended the elims with identical 11-3 records.
Ateneo placed sixth last year.
The Tigresses and the Lady Eagles need only to win once to make it to the best-of-three championship series on Wednesday. The deciding Final Four tie, if needed, will be played at 1 p.m. on Tuesday.
The Lady Tamaraws claimed the last semifinals berth after hurdling the last two elimination round matches.
Prior to scoring a narrow 3-2 win over De La Salle that sealed a semis duel with UST, FEU opened the day with a 3-0 decision of Adamson University.
In the morning ties, the Lady Eagles beat National University, 3-0, while the Lady Paddlers downed University of the Philippines, 3-0.
The Tigresses are gunning for a 14th championship.


Parses the code with Acorn and prints it with Astring.
Include comments Indentation spaces Only show the AST Set link


Projects
-
Indie Game Gallery
This full-stack project was inspired by the 2020 CiGA Game Jam in which I participated.
I had a wonderful experience during the Game Jam event and I wanted to celebrate my achievement of developing a game in 2 day. When I was writing down my experience during the event, it occurred to me that it could be very interesting and inspiring to hear development stories from other participants. Therefore, I decided to build this project to collect and show those development stories.
This was my first "production" level project with real users, and there were quite a few challenges. Because the event has already ended, in order to effectively collect any dev story, I had to develop the project as quickly as possible. Even though I was the only person on the project, I was able to produce a minimum viable product in 3 weeks.
Due to my lack of technical skills, the tech stack I chose made it rather difficult to iterate the project in a fast pace. In the end the project failed to gain traction. This project inspired me to explore a lot more technologies that allows to rapid pace development, such as React and cloud solutions.
-
2020 CiGA 48 Hour Game Jam
This is a game I co-developed in an online Game Jam.
I had just decided to transition into Computer Science industry and I was trying my best to explore the posibilities. Being an avid gamer myself, I have seen a lot of "Game Jam" games before, such as ones from Ludum Dare. Hence, it was extra exciting that I was able to be a part of what I liked. I had an extrodinary experience cooperating with completely random strangers and feeling the adrendeline rush of pushing for a deadline.
Project Link(Warning! The game audio is on and can be loud.)
-
Stock Trade System
This project was inspired by my college friend who decided to try investing in the stock market near the start of the Covid-19 pandenmic.
I built a Python system that can automatically execute trading strategies to buy or sell stocks by calling the Alpaca API. I also built a library so that custom trading strategies can be written and swapped out as users desire.
It was an experimental project and Alpaca API allows for paper trades which is ideal for me. The system with an example trading strategy was deployed onto Heroku and ran for a month, which did not yield an exciting profit (it in fact lost 3%). I envisioned incorporating machine learning models into the trading strategies to "better" predict the stock prices.
-
Physics Playground
This was my very first toy "website" that I wrote when I was just getting into web dev, and it was also my way of saying goodbye to my physics career.
I always hoped more people can like and learn about physics, so I tried to create a site that can potentially help explain/visualize some of the non-intuitive physics phenomena.
The page was built with very "primative" techs. Because this page was meant to be a toy project, it was not that good, and you can probably see that I was trying weird things (that do not go well together).


Source code for discordSuperUtils.Antispam
from __future__ import annotations
import asyncio
from abc import ABC, abstractmethod
from datetime import timedelta
from difflib import SequenceMatcher
from typing import (
TYPE_CHECKING,
List,
Union,
Any,
Iterable
)
import discord
from .Base import EventManager, get_generator_response
from .Punishments import get_relevant_punishment
if TYPE_CHECKING:
from discord.ext import commands
from .Punishments import Punishment
__all__ = ("SpamManager", "SpamDetectionGenerator", "DefaultSpamDetectionGenerator")
[docs]class SpamDetectionGenerator(ABC):
"""
Represents a SpamManager that filters messages to find spam.
"""
__slots__ = ()
[docs] @abstractmethod
def generate(self, last_messages: List[discord.Message]) -> Union[bool, Any]:
"""
This function is an abstract method.
The generate function of the generator.
:param last_messages: The last messages sent (5 is max).
:type last_messages: List[discord.Message]
:return: A boolean representing if the message is spam.
:rtype: Union[bool, Any]
"""
pass
[docs]class DefaultSpamDetectionGenerator(SpamDetectionGenerator):
[docs] def generate(self, last_messages: List[discord.Message]) -> Union[bool, Any]:
member = last_messages[0].author
if member.guild_permissions.administrator:
return False
return SpamManager.get_messages_similarity([message.content for message in last_messages]) > 0.70
[docs]class SpamManager(EventManager):
"""
Represents a SpamManager which detects spam.
"""
__slots__ = ("bot", "generator", "punishments", "_spam_cache", "_last_messages")
def __init__(self,
bot: commands.Bot,
generator: SpamDetectionGenerator = None,
wipe_cache_delay: timedelta = timedelta(minutes=5)):
super().__init__()
self.bot = bot
self.generator = generator if generator is not None else DefaultSpamDetectionGenerator
self.wipe_cache_delay = wipe_cache_delay
self.punishments = []
self._spam_cache = {}
self._last_messages = {}
self.bot.loop.create_task(self.__wipe_cache())
self.bot.add_listener(self.__handle_messages, "on_message")
self.bot.add_listener(self.__handle_messages, "on_message_edit")
async def __wipe_cache(self):
"""
This function is responsible for wiping the member cache.
:return:
"""
while not self.bot.is_closed():
await asyncio.sleep(self.wipe_cache_delay.total_seconds())
self._spam_cache = {}
[docs] @staticmethod
def get_messages_similarity(messages: Iterable[str]) -> float:
"""
Gets the similarity between messages.
:param messages: Messages to compare.
:type messages: Iterable[str]
:rtype: float
:return: The similarity between messages (0-1)
"""
results = []
for i, message in enumerate(messages):
for second_index, second_message in enumerate(messages):
if i != second_index:
results.append(SequenceMatcher(None, message, second_message).ratio())
return sum(results) / len(results) if results else 0
[docs] def add_punishments(self, punishments: List[Punishment]) -> None:
self.punishments = punishments
async def __handle_messages(self, message, edited_message=None):
message = edited_message or message
if not message.guild or message.author.bot:
return
member_last_messages = self._last_messages.setdefault(message.guild.id, {}).get(message.author.id, [])
member_last_messages.append(message)
member_last_messages = member_last_messages[-5:]
self._last_messages[message.guild.id][message.author.id] = member_last_messages
if len(member_last_messages) <= 3 or not get_generator_response(self.generator, SpamDetectionGenerator, member_last_messages):
return
# member_warnings are the number of times the member has spammed.
member_warnings = self._spam_cache.setdefault(message.guild.id, {}).get(message.author.id, 0) + 1
self._spam_cache[message.guild.id][message.author.id] = member_warnings
await self.call_event("on_message_spam", member_last_messages, member_warnings)
if punishment := get_relevant_punishment(self.punishments, member_warnings):
await punishment.punishment_manager.punish(message, message.author, punishment)