Skip to content

Instantly share code, notes, and snippets.

View loloof64's full-sized avatar
💻
Developing projects in Rust

laurent bernabé loloof64

💻
Developing projects in Rust
  • Bayonne (France) in Pyrénées Atlantiques (64)
View GitHub Profile
@loloof64
loloof64 / AppImageBuilder.yml
Created December 25, 2023 01:09
Fichiers complémentaires du tutoriel vidéo sur la création d'AppImage
# appimage-builder recipe see https://appimage-builder.readthedocs.io for details
version: 1
script:
- rm -rf AppDir || true
- cp -r build/linux/x64/release/bundle AppDir
- mkdir -p AppDir/usr/share/icons/hicolor/512x512/apps/
- cp light.png AppDir/usr/share/icons/hicolor/512x512/apps/
AppDir:
path: ./AppDir
app_info:
@loloof64
loloof64 / Cargo.toml
Created November 9, 2023 20:55
A simple dice with Rui framework (for Rust)
[package]
name = "dice"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
rui = "0.6.1"
vger = "0.2.7"
@loloof64
loloof64 / background.rs
Created December 26, 2022 15:04
Chess background (Iced Rust)
use iced::widget::canvas::{self, Cursor, Event, Geometry};
use iced::widget::canvas::{Cache, Canvas, Path, Text};
use iced::{event, mouse, Color, Element, Font, Length, Point, Rectangle, Size, Theme};
#[derive(Debug, Clone)]
pub enum Message {}
#[derive(Default)]
pub enum Interaction {
#[default]
@loloof64
loloof64 / background.rs
Created December 24, 2022 16:52
Simple canvas (Iced experiment)
use iced::widget::canvas::{self, Cursor, Event, Geometry};
use iced::widget::canvas::{Cache, Canvas, Path};
use iced::{event, mouse, Color, Element, Length, Rectangle, Theme};
#[derive(Debug, Clone)]
pub enum Message {}
pub enum Interaction {
None,
}
@loloof64
loloof64 / ChessBoard.kt
Created December 22, 2022 12:44
Simple Jetpack compose project : issue with App architecture being not responsive
package com.loloof64.compose_chess_experiment.ui.components.chess_board
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.Button
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
@loloof64
loloof64 / disconnect_android_wifi
Created February 14, 2022 15:08
Disconnect android wifi Linux
echo 'Disconnect your android device by WIFI'
echo '-----------------------------------'
echo 'You must first ensure that :'
echo '1) Your device enable USB connection in the developper settings,'
echo '2) adb (Android debug bridge) command is in your path,'
echo '3) your device and your computer are on the same Wifi network.'
ip_adress=$(adb devices | grep -o -P '192\.\d+\.\d+\.\d+' | sed -n 's/\(.*\)/\1/p')
adb disconnect $ip_adress > /dev/null
@loloof64
loloof64 / connect_android_wifi
Created February 14, 2022 15:06
Connect android device by WiFi - Linux (tested on Ubuntu 20.04 64 bit)
echo 'Connect your android device by WIFI'
echo '-----------------------------------'
echo 'You must first ensure that :'
echo '1) Your device enable USB connection in the developper settings,'
echo '2) adb (Android debug bridge) command is in your path,'
echo '3) your device and your computer are on the same Wifi network.'
echo "Also don't forget to disconnect device from adb, you can run script disconnect_android_wifi for that."
echo "Then plug your device by USB and press ENTER when you're ready:"
read dummy_variable
@loloof64
loloof64 / main.rs
Created January 8, 2022 14:22
[Rust][SmartPointer]A very simple RefCell use case
use std::cell::RefCell;
fn main() {
let x = RefCell::new(42);
{
let mut y = x.borrow_mut();
*y += 60;
}
println!("{:?}", x);
}
@loloof64
loloof64 / Cargo.toml
Last active January 2, 2022 23:31
[Rust][Relm 4]Simple user greet example
[package]
name = "greet-user"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
gtk = {version = "0.3", package = "gtk4"}
relm4 = "0.2"
@loloof64
loloof64 / Main.kt
Created December 7, 2021 18:57
TicTacToe in Jetpack Compose Desktop (No winner check)
import androidx.compose.desktop.DesktopMaterialTheme
import androidx.compose.desktop.ui.tooling.preview.Preview
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.background
import androidx.compose.foundation.gestures.detectTapGestures
import androidx.compose.foundation.layout.*
import androidx.compose.material.Button
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf