Skip to content

Instantly share code, notes, and snippets.

View fzoccara's full-sized avatar
💫
out my comfort zone is where the magic happens

Francesco Zoccarato fzoccara

💫
out my comfort zone is where the magic happens
  • SintraConsulting
  • Venice
View GitHub Profile
@fzoccara
fzoccara / shopify-multipass-demo.cs
Created February 18, 2022 10:19 — forked from drovani/shopify-multipass-demo.cs
Sample C# Code to Generate Shopify Multipass Url
string secret = "[shopify-multipass-secret]";
string store = "[shopify-store]";
var json = System.Text.Json.JsonSerializer.Serialize(new {
email = "[customer-email]",
created_at = DateTime.Now.ToString("O"),
identifier = "[customer-uid]",
//remote_ip = ""
});
var hash = System.Security.Cryptography.SHA256.Create().ComputeHash(Encoding.UTF8.GetBytes(secret));
@fzoccara
fzoccara / api.py
Created July 6, 2021 14:55 — forked from alanhamlett/api.py
Serialize SQLAlchemy Model to dictionary (for JSON output) and update Model from dictionary attributes.
import uuid
import wtforms_json
from sqlalchemy import not_
from sqlalchemy.dialects.postgresql import UUID
from wtforms import Form
from wtforms.fields import FormField, FieldList
from wtforms.validators import Length
from flask import current_app as app
from flask import request, json, jsonify, abort
<p>To send command into some widget we use PostMessage (https://developer.mozilla.org/ru/docs/Web/API/Window/postMessage)<br>
Way to find required <iframe> is option "id" passed for initialization</p>
<p>Javascript and further HTML is Exapmle</p>
<p>NOTE: We use this tricky way because we need to handle all widgets the same. Both initialized with tv.js (https://www.tradingview.com/widget/advanced-chart/) and initialized self-replaced script (https://www.tradingview.com/widget/technical-analysis/)</p>
<!-- Example start -->
<!-- Advanced chart widget initialization -->
<div id="advanced-chart-widget-container"></div>
<script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script>

Best Practices for Azure Redis

Below are a set of best practices that I recommend for most customers. This information is based on my experience helping hundreds of Azure Redis customers investigate various issues.

Configuration and Concepts

  1. Use Standard or Premium Tier for Production systems. The Basic Tier is a single node system with no data replication and no SLA. Also, use at least a C1 cache. C0 caches are really meant for simple dev/test scenarios since they have a shared CPU core, very little memory, are prone to "noisy neighbor", etc.
  2. Remember that Redis is an In-Memory data store. Read this article so that you are aware of scenarios where data loss can occur.
  3. Configure your client library to use a "connect timeout" of at least 10 to 15 seconds, giving the system time to connect even under higher CPU conditions. If your client or server tend to be under high load
/*****************************************************/
// Email Checker
// Designer : Arturo Erbsman
// Programmer : Antoine Villeret
// ENSADLab - 2010
/*****************************************************/
#include <Ethernet.h>
#define LEDPIN 9 // LED connected to this pin
@fzoccara
fzoccara / SMTP_ESP8266.ino
Created September 23, 2018 20:51 — forked from igrr/SMTP_ESP8266.ino
ESP8266 Arduino SMTPClient test
// Download SMTPClient library from https://github.com/gregington/SMTPClient
#include <ESP8266WiFi.h>
#include <Client.h>
#include <Mail.h>
#include <SMTPClient.h>
WiFiClient wifiClient;
SmtpClient client(&wifiClient, "smtp.163.com");
@fzoccara
fzoccara / Apache Ab.sh
Last active August 16, 2018 09:27 — forked from Integralist/Apache Ab.sh
Apache Ab Stress Test CLI tool
# Run Ubuntu
docker run -it ubuntu
# Update packages
apt-get update
# Install manual pages
apt-get install man
# Install (amongst other things) the `ab` command
> Regular Expressions Cheat Sheet
> A regular expression specifies a set of strings that matches it. This cheat sheet is based off Python 3's Regular Expressions (http://docs.python.org/3/library/re.html) but is designed for searches within Sublime Text.
> Special Characters
\ Escapes special characters or signals a special sequence.
. Matches any single character except a newline.
^ Matches the start of the string.
$ Matches the end of the string.
* Greedily matches 0 or more repetitions of the preceding RE.
*? Matches 0 or more repetitions of the preceding RE.
@fzoccara
fzoccara / SocialApi
Last active March 8, 2018 15:36 — forked from jonathanmoore/gist:2640302
Get the share counts from various APIs
Share Counts
============
I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example [The Next Web](http://thenextweb.com/shareables/2012/05/08/move-over-zuck-abraham-lincoln-filed-a-patent-for-facebook-in-1845/) I decided to look into the various APIs on how to simply return the share count.
**If you want to roll up all of these into a single jQuery plugin check out [Sharrre](http://sharrre.com/)**
*Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.*
Twitter

ESP8266 Web Server to storing ap config to EEPROM.

Original by chriscook8 from esp8266.com I just modified to use ESP8266WebServer library for easy to handle the http request.

This is sample code not yet complete.

Todo

  • when Wifi connected need to close the softAP.