Skip to content

Instantly share code, notes, and snippets.

View stephanedeluca's full-sized avatar

Stéphane de Luca stephanedeluca

View GitHub Profile
@stephanedeluca
stephanedeluca / zid.upload.js
Created August 6, 2019 10:32
Image upload for javascript
//﷽
// zid.upload.js: Image upload
// Derived from ALADDIN work by Stéphane de Luca on Tuesday July 13th 2017
// Copyright ALADDIN © 2013 by Stéphane de Luca
// Release notes:
// — v1b0: Tuesday July 13th 2017 15h47: Initial version.
// — v1b1: Tuesday July 13th 2017 21h50: support M2S url publising.
// — v1b2: Wednesday July 26th 2017 14h24 @ Paris: support max size error.
// — v1b3: Thursday July 27th 2017 10h58 @ Paris les Halles chez Monop : Fixed error propagation.
@stephanedeluca
stephanedeluca / main.dart
Last active June 10, 2022 15:34
Reverse what I presume is a CRC16 from data samples, so that I can compte the CRC for whatever the data are.
/*
Reverse the CRC16 from the data sample.
@Author Stéphane "Sdl" de Luca on Friday June 10th 2022 4:22 in Tangier, Morocco.
@See https://crypto.stackexchange.com/questions/100474/how-can-i-reverse-a-so-called-crc16-from-the-data/100511#100511 for indepth information.
*/
int crc16(int value) {
const table = [
//0xBB83, //0000
0x7A43, // 0001
@stephanedeluca
stephanedeluca / main.dart
Last active June 21, 2022 09:21
Compute a CRC-16/Modbus
//import 'dart:ffi';
int crc16Modbus(List<int> bytes){
const crc16 = 0xA001;
int crc = 0xFFFF;
if (false) {
for (int pos = 0; pos < bytes.length; pos++) {
crc ^= bytes[pos]; // XOR byte into least sig. byte of crc
@stephanedeluca
stephanedeluca / main.dart
Last active June 6, 2023 04:07
Create an non existant enum in dart
/// Shows what to do when creating an enum value from a integer value
enum ThemeColor { red, green,}
void main() {
try {
final nonExistent = ThemeColor.values[3];
print("Non existent enum is $nonExistent");
@stephanedeluca
stephanedeluca / main.dart
Last active April 22, 2023 20:01
Dart: makes an https download
//import 'dart:io';
//import 'dart:convert';
//const c = [0, 0, 184, 84, 0, 2, 40, 3, 100, 65, 36, 97, 0, 1, 0, 0, 0, 0, 0, 0, 8, 252, 0, 0, 0, 2, 167, 120, 119, 177, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 115, 0, 0, 0, 0, 12, 0, 0, 1, 0];
/// @history Create by Sdl on Friday April 21th 2023
/// Expecte results:
/// {cache-control: max-age:0, content-length: 24, content-md5: qVT+sY2zlNke425Qebybmw==, content-type: application/octet-stream, date: Fri, 21 Apr 2023 07:35:20 GMT, etag: 0x8DB41BEC85E6579, last-modified: Thu, 20 Apr 2023 16:46:26 GMT, x-ms-blob-type: BlockBlob, x-ms-lease-status: unlocked, x-ms-request-id: cbe6933b-c01e-0002-8023-747c9b000000, x-ms-version: 2009-09-19}
/// OK: reponse is: [7, 231, 4, 20, 24, 66, 0, 0, 1, 0, 0, 0, 0, 0, 39, 153, 0, 0, 39, 153, 0, 0, 40, 8]
/// File date: 4/20/2023 24:66
@stephanedeluca
stephanedeluca / main.dart
Last active April 22, 2023 20:13
How to make child apparition smooth and animated?
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
@stephanedeluca
stephanedeluca / main.dart
Created April 27, 2023 19:35
golden-kingdom-9162
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
@stephanedeluca
stephanedeluca / virtualCpuImplementationChallenge.txt
Created May 12, 2023 08:14
The virtual CPU implementation challenge
# The virtual CPU implementation test
Hello, I am Steven de Luca, CTO.
I'd like to engage you in a test which consits of designing and implementing a virtual processor capables of running actual small binary programs.
In this test, I 'd like to evaluate your understanding of a technical problem to solve, measure your sw architecturing skills and the quality of the code you write, including style and maintainability over time and across a whole team.
It is probable that you never use Dart language so far, learning it during the test is also a way to evaluate your capacity to face the ever changing nature of the programing world.
@stephanedeluca
stephanedeluca / main.dart
Last active May 31, 2023 17:24
Shokaze category details form designer
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@stephanedeluca
stephanedeluca / main.dart
Created July 1, 2023 15:52
crimson-rose-2138
import 'package:flutter/material.dart';
// lets define the stateless part of the screen (AppBar, app title, background color...)
class MetaDataAdScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: "product informations",
home:Scaffold(