Skip to content

Instantly share code, notes, and snippets.

View lovasoa's full-sized avatar
🎯
Focusing

Ophir LOJKINE lovasoa

🎯
Focusing
View GitHub Profile
@lovasoa
lovasoa / learnsqlpage.css
Last active August 16, 2024 13:54
learnsqlpage.com
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&family=Fira+Code&display=swap');
:root {
--primary-color: #2d3748;
--secondary-color: #718096;
--accent-color: #3182ce;
--background-color: #f3f9fc;
--heading-color: #1a202c;
--text-color: #3a4558;
--border-color: #e2e8f0;
@lovasoa
lovasoa / maretraitenupes.fr.js
Last active June 27, 2024 23:26
maretraitenupes.fr.js
function vousrecevrez(pension) {
const csg1 = getCSGRate1(pension) * 0.985 * pension;
const csg2 = getCSGRate2(pension) * 0.985 * pension;
const pensionNet1 = pension; //calculatePensionAfterCSG(pension, getCSGRate1(pension));
const pensionNet2 =
((1 - getCSGRate2(pension)) * pension) / (1 - getCSGRate1(pension)); //calculatePensionAfterCSG(pension, getCSGRate2(pension));
const difference = (pensionNet2 - pensionNet1) * 12;
const pensionBrutte = pension / (1 - getCSGRate1(pension));
[package]
name = "hash_miner"
version = "0.1.0"
edition = "2021"
[dependencies]
rayon = "1.5"
sha2 = "0.10"
num_cpus = "1.13"
@lovasoa
lovasoa / pompes.py
Last active September 11, 2023 07:49
pompes à cocktail
import board
import busio
from adafruit_mcp230xx.mcp23017 import MCP23017
import time
from typing import List, Tuple
i2c = busio.I2C(board.SCL, board.SDA)
mcp = MCP23017(i2c, address=0x27)
NOMBRE_POMPES = 16
@lovasoa
lovasoa / gale_2.csv
Created May 13, 2023 11:08
Solutions to all stable mariage problems of size 2 and 3
man_1_preference_1 man_1_preference_2 man_2_preference_1 man_2_preference_2 woman_1_preference_1 woman_1_preference_2 woman_2_preference_1 woman_2_preference_2 woman_1_mariage woman_2_mariage
1 2 1 2 1 2 1 2 1 2
1 2 1 2 1 2 2 1 1 2
1 2 1 2 2 1 1 2 2 1
1 2 1 2 2 1 2 1 2 1
1 2 2 1 1 2 1 2 1 2
1 2 2 1 1 2 2 1 1 2
1 2 2 1 2 1 1 2 1 2
1 2 2 1 2 1 2 1 1 2
@lovasoa
lovasoa / lib.rs
Last active October 30, 2022 00:33
autovec : alternative to rust's standard vector type which uses column-oriented storage for better code auto-vectorization. In short: makes rust code working with vectors of structs magically faster.
#[derive(Clone, Debug, PartialEq)]
struct B {
x: bool,
y: f64,
}
pub trait AutoVec {
type Vec;
}
@lovasoa
lovasoa / ethernet_delayed_echo_server.rs
Last active October 22, 2022 23:16
Ethernet echo server with a fixed delay between request and response
// See https://www.reddit.com/r/rust/comments/yaqsqe/how_to_delay_lots_of_synchronous_actions/?sort=new
use pnet::datalink::{self};
use pnet::datalink::Channel::Ethernet;
use pnet::datalink::DataLinkSender;
use pnet::packet::ethernet::MutableEthernetPacket;
use std::sync::mpsc;
use std::time::Instant;
fn main() {
import sys
from numpy import *
from collections import Counter
n = int(sys.argv[1])
def mat_fun(i,j): return (j == (i+1)%9) | ((i==6) & (j==0))
M = matrix(fromfunction(mat_fun, (9, 9)), dtype=int)**n
ages=Counter(map(int,input().split(',')))
sizes=array([ages[i] for i in range(9)])
print(M.dot(sizes).sum())
from asyncua import ua
from asyncua.ua import ua_binary
import sys
import timeit
obj = ua.WriteParameters(NodesToWrite=[
ua.WriteValue(
NodeId_=ua.NodeId("hello_world"),
Value=ua.DataValue(
Value=
@lovasoa
lovasoa / id_ed25519.pub
Created December 11, 2020 14:54
X1 public key
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGZ4MWfrK3MrBbfj+xP72A5Up2JT5p6pT9fv1UmNs4WF ophir-x1