Skip to content

Instantly share code, notes, and snippets.

View prongbang's full-sized avatar
🏠
Working from home

prongbang prongbang

🏠
Working from home
View GitHub Profile
use flate2::write::GzEncoder;
use flate2::Compression;
use log::info;
use std::fs::File;
use std::io::{copy, Error};
use std::io::BufReader;
use std::time::Instant;
use std::fs::File;
use std::io::{BufReader, Cursor, Read, Write};
use flate2::Compression;

Fix: Unable to connect to the server: x509: certificate has expired or is not yet valid:

Certificate expired

sudo microk8s.refresh-certs -c
The CA certificate will expire in 3649 days.
use std::path::Path;
use turbojpeg::image::EncodableLayout;
use crate::api::convert;
pub async fn compress(image_path: String) -> Result<Vec<u8>, anyhow::Error> {
let path = Path::new(image_path.as_str());
let ext = path.extension().and_then(|ext| ext.to_str()).unwrap_or("");
let jpeg_data: Vec<u8>;
if ext != "jpg" && ext != "jpeg" {
import 'package:google_api_availability/google_api_availability.dart';
enum ServicesAvailability {
success,
serviceMissing,
serviceUpdating,
serviceVersionUpdateRequired,
serviceDisabled,
serviceInvalid,
notAvailableOnPlatform,
# Using Namespaces
https://docs.rafay.co/learn/quickstart/kubernetes/namespaces/
- List Namespace
```shell
microk8s kubectl get namespaces
```
# Create a MicroK8s cluster
https://microk8s.io/docs/clustering
## Example
- Adding a node
```shell
microk8s add-node
package tokenx
import (
"encoding/hex"
"github.com/go-jose/go-jose/v4"
"github.com/goccy/go-json"
)
type JWXToken Token
void disableScreenRecording({bool enabled = false}) async {
// Get the Android device.
final device = await FlutterDevice.current;
// Run the "adb shell settings put secure allow_screen_captures" command.
final result = await device.run('adb', [
'shell',
'settings',
'put',
'secure',
import 'dart:io';
void main() {
// Get the current platform.
final platform = Platform.isAndroid ? 'android' : 'ios';
// Disable remote desktop for the current platform.
if (platform == 'android') {
// Set the value of the "adb tcpip" command to 0.
Process.run('adb', ['tcpip', '0']);