This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import permutations | |
perm = permutations([*range(0,10)], 7) | |
f, u, s, b, a, l, c = [1,2,3,4,5,6,7] | |
def fp(): | |
return f + b == c or (u + a > 9 and f + b + 1 == c) or (s+l > 9 and u + a + 1> 9 and f + b + 1 == c) | |
def up(): | |
return ((s+l+1) % 10) == u and (u + a + 1) % 10 == l |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cod": "200", | |
"message": 0, | |
"cnt": 40, | |
"list": [ | |
{ | |
"dt": 1727384400, | |
"main": { | |
"temp": 15.51, | |
"feels_like": 15.34, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:flutter_bloc/flutter_bloc.dart'; | |
final class SwitchState { | |
static const on = 1; | |
static const enabled = 2; | |
final int state; | |
const SwitchState(this.state); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdbool.h> | |
#include <unistd.h> | |
#include <limits.h> | |
#include "esp_timer.h" | |
#include "esp_task_wdt.h" | |
#define TEST_COUNT 10000000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function clamp(rgb) { | |
return rgb < 0 ? 0 : rgb > 255 ? 255 : parseInt(rgb); | |
} | |
function weatherTempToRGB(temp) { | |
let r, g, b; | |
if (temp >= 23) { | |
let t = (temp - 23) / 27.0; | |
g = (1 - t) * 200; | |
r = 200 + t * 50; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Arduino.h> | |
#include <Wire.h> | |
#include <math.h> | |
#include "SPI.h" | |
#include "TFT_eSPI.h" | |
#define TFT_GREY 0x7BEF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "esp_log.h" | |
#include "nvs_flash.h" | |
/* BLE */ | |
#include "esp_nimble_hci.h" | |
#include "nimble/nimble_port.h" | |
#include "nimble/nimble_port_freertos.h" | |
#include "host/ble_hs.h" | |
#include "host/util/util.h" | |
#include "console/console.h" | |
#include "services/gap/ble_svc_gap.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import glob | |
import os | |
import re | |
spath = os.path.dirname(os.path.realpath(__file__)) | |
all_fonts = [fon[len(spath)+1:] for fon in glob.glob(spath + '/fonts/*.c')] | |
all_headers = [re.sub(r"\.c$", ".h", f) for f in all_fonts] | |
root = spath + "/../../.."; | |
used = {} | |
for cdir, subdirs, files in os.walk(root): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use PDF::Haru; | |
use Text::QRCode; | |
use POSIX 'floor'; | |
use strict; | |
use warnings; | |
# create new document | |
my $pdf = PDF::Haru::New(); | |
#$pdf->LoadTTFontFromFile("/usr/share/fonts/truetype/msttcorefonts/arial.ttf", HPDF_TRUE); | |
# add page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub _php_jquery_param { | |
my ($root, $path, $value) = @_; | |
my @struct = $path =~ /\[?([^\[\]]+)\]?/g; | |
return if !@struct; | |
my $sl = \$root; | |
for my $key (@struct) { | |
if ($key =~ /^\d+$/) { | |
$$sl //= []; | |
$sl = \$$sl->[$key]; | |
} else { |
NewerOlder