Skip to content

Instantly share code, notes, and snippets.

View guiyomh's full-sized avatar
😀

Guillaume Camus guiyomh

😀
View GitHub Profile
@guiyomh
guiyomh / genetic.rs
Created August 31, 2023 09:16
rust genetic algo
use rand::prelude::*;
use crate::{ELITISM, GENERATIONS_COUNT, GENOME_SIZE, LOG, POPULATION_SIZE, SELECTION_RATIO};
static mut UNIFORM_RATE: f64 = 0.5;
static mut MUTATION_RATE: f64 = 0.06;
#[derive(Debug, Clone)]
pub struct Gene {
random: f64,
@guiyomh
guiyomh / cartesian.rs
Created August 31, 2023 09:12
RUST features for Cartesian mathematics, vectors, points and physical operations
// Module for handling basic Cartesian geometry operations.
use std::ops::{Add, Mul, Sub};
/// Represents a point in Cartesian coordinates.
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct Point {
pub x: f64,
pub y: f64,
}
@guiyomh
guiyomh / README.md
Created December 8, 2022 10:08 — forked from PurpleBooth/README.md
A github workflow pipeline for rust that does test, build and deploy windows, linux and mac, creates releases, and does SemVer Versioning, and releases to a homebrew tap

Features

  • Automatically bump SemVer
  • Update a personal homebrew tap
  • Keep that pesky version in the Cargo.toml up to date
  • (From dependabot) Get new versions out as soon as possible

Assumptions

  • You don't want a changelog
@guiyomh
guiyomh / Grid.kt
Created January 10, 2021 17:47 — forked from bmc08gt/Grid.kt
Jetpack Compose dynamic grid
import androidx.compose.foundation.Box
import androidx.compose.foundation.layout.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.key
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
@Composable
fun <T>Grid(
@guiyomh
guiyomh / crontab_header.sh
Created March 23, 2020 17:47 — forked from wesleyit/crontab_header.sh
A default crontab header that will make the life easier for those who don't remember cron fields or keywords.
## CRONTAB HINTS AND TIPS
##
##
## Entry Description Equivalent To
## @yearly (or @annually) Run once a year at midnight in the morning of January 1 0 0 1 1 *
## @monthly Run once a month at midnight in the morning of the first of the month 0 0 1 * *
## @weekly Run once a week at midnight in the morning of Sunday 0 0 * * 0
## @daily Run once a day at midnight 0 0 * * *
## @hourly Run once an hour at the beginning of the hour 0 * * * *
## @reboot Run at startup @reboot
@guiyomh
guiyomh / ngrok_port.go
Created March 14, 2020 15:43 — forked from milanaleksic/ngrok_port.go
Ngrok free mode always has only one single tunnel allowed. If you use TCP tunnel, this script extracts the value (since ngrok doesn't have server API). This way you can connect to that port from a script (ssh tunnel is my favorite usage of ngrok) instead of having to visit the site manually to get this value.
package main
import (
"bufio"
"errors"
"fmt"
"io"
"log"
"net/http"
"net/http/cookiejar"
@guiyomh
guiyomh / addContext.js
Created June 17, 2019 12:52 — forked from NicholasBoll/addContext.js
Cypress mochawesome report. All files go into `cypress` directory
const addContext = (report, screenshots, videoUrl) => {
const getTests = t => t.tests
const getSuites = t => t.suites
const addSuiteContext = (suite, previousTitles = []) => {
const titles = suite.title ? previousTitles.concat(suite.title) : previousTitles
getTests(suite).forEach(test => {
test.timedOut = false // for some reason this is dropped
const context = [
{
@guiyomh
guiyomh / igdump
Created December 3, 2018 10:37 — forked from michelv/igdump
igdump : a command line utility to unserialize and dump igbinary-serialized PHP data
#!/usr/bin/env php
<?php
if (isset($argv[1]) && ($argv[1] == '--help' || $argv[1] == '-h')) {
echo sprintf(
"Usage: \n [igbinary-serialized data] | %s\n",
basename(__FILE__)
);
exit();
}
FROM php:7-alpine
RUN set -xe \
&& apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
&& pecl install xdebug
ENV XDEBUG_ENABLED=0 \
XDEBUG_REMOTE_HOST=0.0.0.0
@guiyomh
guiyomh / README.md
Created October 19, 2018 13:51 — forked from hassansin/README.md
Remote Debugging with XDebug 2.1

XDebug

A PHP extension that allows you to:

  1. walk through your code by Remote Debugging
  2. find bottlenecks in your application by Profiling
  3. find Code Coverage in a single request
  4. trace your application by logging all function calls