Skip to content

Instantly share code, notes, and snippets.

View Flatroy's full-sized avatar

George Daneke Flatroy

View GitHub Profile
class LineChart {
// LineChart by https://kevinkub.de/
constructor(width, height, values) {
this.ctx = new DrawContext();
this.ctx.size = new Size(width, height);
this.values = values;
}
_calculatePath() {
@Flatroy
Flatroy / Subscription.php
Created January 20, 2022 21:02 — forked from Shelob9/Subscription.php
Laravel Spark with Laravel Nova
<?php
namespace App\Nova;
use Laravel\Nova\Fields\BelongsTo;
use Laravel\Nova\Fields\Date;
use Laravel\Nova\Fields\ID;
use Illuminate\Http\Request;
use Laravel\Nova\Http\Requests\NovaRequest;

Cryptographic Best Practices

Putting cryptographic primitives together is a lot like putting a jigsaw puzzle together, where all the pieces are cut exactly the same way, but there is only one correct solution. Thankfully, there are some projects out there that are working hard to make sure developers are getting it right.

The following advice comes from years of research from leading security researchers, developers, and cryptographers. This Gist was [forked from Thomas Ptacek's Gist][1] to be more readable. Additions have been added from

@Flatroy
Flatroy / README.md
Created July 27, 2021 09:02
Database Dumper

Database Dumper

  1. Copying files dumper.php and config.yaml.

  2. Seting up config.yaml

  3. Setting up cron. For example:

    0 4 * * * cd /var/www/backups && /usr/local/bin/php dumper.php config.yaml

  4. Or manual: php dumper.php config.yaml

  5. Profit!

@Flatroy
Flatroy / mail2telegram.js
Created April 11, 2021 15:32 — forked from ivanfgm/mail2telegram.js
Small script to send received emails to a telegram bot, easy piece thanks to: node-telegram-bot-api and mail-listener2
const makeBot = require('node-telegram-bot-api');
const mailListener = require("mail-listener2");
const config = {
// First get your telegram bot
telegramToken: 'Obtain your token talking to BotFather on telegram',
// Send a message to the bot and paste here your chat id (the response)
// TODO: login to avoid this step and allow multiple users
chatID = 'Chat ID',
// Gmail or Gsuite settings
@Flatroy
Flatroy / laravel.stpl
Created June 11, 2019 09:50 — forked from inerba/laravel.stpl
Laravel template VESTACP
# /usr/local/vesta/data/templates/web/apache2/laravel.stpl
<VirtualHost %ip%:%web_ssl_port%>
ServerName %domain_idn%
%alias_string%
ServerAdmin %email%
DocumentRoot %sdocroot%/public/
ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/
Alias /vstats/ %home%/%user%/web/%domain%/stats/
@Flatroy
Flatroy / Kohana 3.X auth snippets.php
Created January 13, 2016 14:47 — forked from maid450/Kohana 3.X auth snippets.php
Kohana 3.X auth snippets
<?php
//Useful code snippets
//Here are some code snippets which show you the basics of Auth:
//Create a new user (e.g. if you have not set up any users yet and want to do that programmatically)
$model = ORM::factory('user');
$model->values(array(
'username' => 'admin',
'email' => '[email protected]',
'password' => 'admin',
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);