Skip to content

Instantly share code, notes, and snippets.

View sammyrulez's full-sized avatar

Sam Reghenzi sammyrulez

View GitHub Profile
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout
uses: actions/checkout@v2
- id: next_version
uses: zwaldowski/semver-release-action@v1
with:
bump: patch
prefix: api_server_v
github_token: ${{ secrets.GITHUB_TOKEN }}
@sammyrulez
sammyrulez / monrepo.yaml
Last active September 3, 2020 04:42
labeler
name: Monorepo PR Repo Labeler
on:
pull_request:
types: [opened]
branches:
- main
jobs:
labelPR:
@sammyrulez
sammyrulez / lint_and_test.yaml
Last active January 12, 2022 23:30
sniplet
on:
push:
branches:
- main
paths:
- "amazon_scraper/**"
m = Prophet()
m.add_regressor('peak_reg')
m.add_seasonality('peak_period_start',period=22,fourier_order=1)
m.add_seasonality('peak_period_end',period=36,fourier_order=1)
m.fit(df)
future = m.make_future_dataframe(periods=28)
future['ds_ts'] = pd.to_datetime(future['ds'])
future['no_school'] = pd.Timestamp(datetime(2020,2,24))
future['since_no_school'] = future['ds_ts'].sub(future['no_school'], axis=0).dt.days
future['peak_reg'] = future['since_no_school'].apply(peak_days )
@sammyrulez
sammyrulez / forecast.py
Created March 12, 2020 21:31
COVID-19 forecast
m = Prophet()
m.fit(df)
future = m.make_future_dataframe(periods=50)
forecast = m.predict(future)
bs= df.loc[df['sigla_provincia'] == 'BS']
bs = bs.sort_values(by=['data'])
bs = bs.drop(['stato', 'codice_regione', 'denominazione_regione','codice_provincia','sigla_provincia','lat','long','denominazione_provincia'], axis=1)
bs = bs.reset_index(drop=True)
bs.columns = ['ds','y']
@sammyrulez
sammyrulez / endpoint.scala
Created June 13, 2019 14:05
Tapir endpoint config
sealed trait ErrorInfo
case class NotFound(what: String) extends ErrorInfo
case class Unauthorized(realm: String) extends ErrorInfo
case class Unknown(code: Int, msg: String) extends ErrorInfo
case object NoContent extends ErrorInfo
case class Conflict(what: String) extends ErrorInfo
case class ErrorCodeAndMessage(code: String, message: String)
case class GenericErrorInfo(errors: List[ErrorCodeAndMessage]) extends ErrorInfo
def baseEndpoint(basePath: String): Endpoint[Unit, ErrorInfo, Unit, Nothing] = {
package com.github.sammyrulez
import tapir._
import tapir.json.circe._
import io.circe.generic.auto._
import scala.concurrent.{ ExecutionContext, Future }
import akka.http.scaladsl.server.Route
object CharRoutes {
import tapir.server.akkahttp._
@sammyrulez
sammyrulez / echo.sh
Created February 2, 2019 09:46
decode settings.xml
-echo 'PHNldHRpbmdzIHhtbG5zPSJodHRwOi8vbWF2ZW4uYXBhY2hlLm9yZy9TRVRUSU5HUy8xLjAuMCIKICAgICAgICAgIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiCiAgICAgICAgICB4c2k6c2NoZW1hTG9jYXRpb249Imh0dHA6Ly9tYXZlbi5hcGFjaGUub3JnL1NFVFRJTkdTLzEuMC4wCiAgICAgIGh0dHBzOi8vbWF2ZW4uYXBhY2hlLm9yZy94c2Qvc2V0dGluZ3MtMS4wLjAueHNkIj4KICAgIDxzZXJ2ZXJzPgogICAgICAgIDxzZXJ2ZXI+CiAgICAgICAgICAgIDxpZD54eXotcmVsZWFzZXM8L2lkPgogICAgICAgICAgICA8dXNlcm5hbWU+JHtteS5yZXBvLnVzZXJ9PC91c2VybmFtZT4KICAgICAgICAgICAgPHBhc3N3b3JkPiR7bXkucmVwby5wYXNzd29yZH08L3Bhc3N3b3JkPgogICAgICAgICAgICA8IS0tIGRvIHlvdSByZWFsbHkgdGhpbmsgSSB3b3VsZCBoYXZlIHB1dCB0aGUgcGFzc293cmQgaGVyZT8gLS0+CiAgICAgICAgPC9zZXJ2ZXI+CiAgICAgICAgPHNlcnZlcj4KICAgICAgICAgICAgPGlkPnh5ei1zbmFwc2hvdHM8L2lkPgogICAgICAgICAgICAgPHVzZXJuYW1lPiR7bXkucmVwby51c2VyfTwvdXNlcm5hbWU+CiAgICAgICAgICAgIDxwYXNzd29yZD4ke215LnJlcG8ucGFzc3dvcmR9PC9wYXNzd29yZD4KICAgICAgICA8L3NlcnZlcj4KICAgIDwvc2VydmVycz4KPC9zZXR0aW5ncw==' | base64 - decode > settings.xml
@sammyrulez
sammyrulez / settings.xml
Created February 2, 2019 09:41
Maven settings templating with env variable
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
 https://maven.apache.org/xsd/settings-1.0.0.xsd">
 <servers>
 <server>
 <id>xyz-releases</id>
 <username>${my.repo.user}</username>
 <password>${my.repo.password}</password>
 </server>