Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/perl
srand (time());
my $randletter = "(int (rand (26)) + (int (rand (1) + .5) % 2 ? 65 : 97))";
my $salt = sprintf ("%c%c", eval $randletter, eval $randletter);
my $plaintext = shift;
my $crypttext = crypt ($plaintext, $salt);
print "${crypttext}\n";
2020-06-24T16:41:57 [I|app|896c85e1] Started POST "/hosts" for 10.x.x.x at 2020-06-24 16:41:57 +0000
2020-06-24T16:41:57 [I|app|896c85e1] Processing by HostsController#create as */*
2020-06-24T16:41:57 [I|app|896c85e1] Parameters: {"utf8"=>"✓", "authenticity_token"=>"NtDzbGZDLHLqxcsRiGKFQqrK3pE8Hl+hv84ihPnp0+9qpdGyKlAL9V69XW3MY7h/LmFuMOtbWV8zNgBPzMyvxA==", "host"=>{"name"=>"adam-ranildi", "organization_id"=>"8", "location_id"=>"2", "hostgroup_id"=>"1", "content_facet_attributes"=>{"lifecycle_environment_id"=>"4", "content_view_id"=>"4", "content_source_id"=>"1"}, "puppetclass_ids"=>[""], "managed"=>"true", "progress_report_id"=>"[FILTERED]", "type"=>"Host::Managed", "interfaces_attributes"=>{"0"=>{"_destroy"=>"0", "type"=>"Nic::Managed", "mac"=>"", "identifier"=>"", "name"=>"adam-ranildi", "domain_id"=>"2", "subnet_id"=>"1", "ip"=>"10.x.x.x", "ip6"=>"", "managed"=>"1", "primary"=>"1", "provision"=>"1", "virtual"=>"0", "tag"=>"", "attached_to"=>"", "compute_attributes"=>{"type"=>"VirtualE1000", "network"=>"n
ipa-replica-install --setup-ca --setup-dns --mkhomedir --no-ntp --auto-reverse
ipa-replica-install --setup-ca --setup-dns --mkhomedir --no-ntp --auto-reverse --no-forwarders
@preetesh33
preetesh33 / gist:1310a0b1cb37ae2992aca955f58f63dd
Created October 15, 2023 11:03
Amazon price drop notification code
import requests
from bs4 import BeautifulSoup
import smtplib
import time
import sys
# enable secure login in gmail using url https://www.google.com/settings/security/lesssecureapps
#### add expected price
expected_price = 5000
import pandas as pd
from mlforecast import MLForecast
from xgboost import XGBRegressor
from window_ops.rolling import rolling_mean, rolling_max, rolling_min, rolling_std
from mlforecast.forecast import MLForecast
from mlforecast import MLForecast
import os
from joblib import dump
import json
import pandas as pd
import pandas as pd
from joblib import load
import json
from datetime import datetime
import warnings
import logging
import yaml
import pandas as pd
import pandas as pd
from joblib import load
import json
from datetime import datetime
import warnings
warnings.filterwarnings("ignore", category=FutureWarning)
warnings.filterwarnings("ignore", category=DeprecationWarning)
To add seasonality to your forecasting model, you can use Fourier terms. Fourier terms can capture seasonality of any period and are especially useful when the period of the seasonality is large.
In the `MLForecast` class, you can add Fourier terms using the `seasonality` parameter in the `fit` method. The `seasonality` parameter is a dictionary where the keys are the periods of the seasonality and the values are the order of the Fourier series.
Here's how you can modify your code to add weekly and yearly seasonality:
```python
# Assuming your data is in minutes and you want to capture weekly and yearly seasonality
weekly_seasonality = 60 * 24 * 7 # minutes in a week
yearly_seasonality = 60 * 24 * 365 # minutes in a non-leap year