Skip to content

Instantly share code, notes, and snippets.

View jerome-diver's full-sized avatar
🏠
Working from home

Jérôme Lanteri jerome-diver

🏠
Working from home
  • Thailand
View GitHub Profile
@jerome-diver
jerome-diver / xmonad.desktop
Last active March 16, 2023 21:32
xmonad desktop inside /usr/share/xsessions/ directory is never see in SDDM or GDM3 display manager session WM list
[Desktop Entry]
Encoding=UTF-8
Name=XMonad
Comment=Highly configurable Haskell dynamic tiling Window Manager
TryExec=$HOME/.cache/xmonad/xmonad-x86_64-linux
Exec=$HOME/.cache/xmonad/xmonad-x86_64-linux
Type=Application
Icon=xmonad.png
Keywords=Window manager
@jerome-diver
jerome-diver / actions_CRUD.js
Created August 5, 2021 00:14
Container UI design part
/* CRUD for container collection to call from server API
at /api/containers address */
import { TAG, HOST, SERVER_PORT } from '../../Views/helpers/config'
const host = TAG + HOST + ":" + SERVER_PORT
const giveMe = (url, successCBK, failedCBK, finalCBK, isMounted) => {
fetch(url)
.then( response => response.json() )
--[[
Test lgi Lua package with GooCanvas and Modelized items
----]]
local lgi = require 'lgi'
local Goo = lgi.GooCanvas
local Gtk = lgi.Gtk
local win = Gtk.Window { width = 640, height = 500, anchor = Gtk.GTK_WINDOW_TOPLEVEL }
local frame = Gtk.Frame { width = 400, height = 400 }
@jerome-diver
jerome-diver / use_case_get_static_var.py
Created May 12, 2020 19:21
How super mixins can find metaclass child variable
class MixinsBuilder:
"""From child static variable, i'm going to build attributes"""
def build_attributes(self):
my_meta_var = self.???[0]
for k, v in my_meta_var:
if not hasattr(self, k):
setattr(k, v)

Keybase proof

I hereby claim:

  • I am jerome-diver on github.
  • I am jeromelanteri (https://keybase.io/jeromelanteri) on keybase.
  • I have a public key ASDPxWjOCUODu-xi6_JBP-JaCpGhzRTPbdpmlKBnrEgergo

To claim this, I am signing this object:

@jerome-diver
jerome-diver / subprocess_out_to_json
Last active April 21, 2020 19:25
trying to get json object from command returning json through subprocess call
import json
import subprocess
# you need to have taskwarrior application installed on the Linux system to rich the shell command to return a json data
j = json.loads(subprocess.run(["task", "status:pending", "export"], capture_output=True, check=True).stdout)
@jerome-diver
jerome-diver / custom_failure.rb
Created March 18, 2020 18:57
trying to redirect_to controller users/session action new as JS, but get back 422 error due to forgery protection
class CustomFailureApp < Devise::FailureApp
def redirect
store_location!
message = warden.message || warden_options[:message]
puts("Messages from Warden: #{message}")
case message
when :timeout
redirect_to root_path
when :unconfirmed
redirect_to new_user_session_path(format: :js)
@jerome-diver
jerome-diver / assets.rb
Created February 10, 2020 16:31
ruby-2.7 ActionView:Template:Error (undefined method 'start_with?' for /\.(?:svg|eot|woff|ttf)\z:Regexp)
Rails.apoplication.config.assets.precompile << (/\.(?:svg|eot|woff|ttf)\z)
@jerome-diver
jerome-diver / spectrwm.conf
Last active November 6, 2019 17:41
spectrwm config file
# PLEASE READ THE MAN PAGE BEFORE EDITING THIS FILE!
# https://htmlpreview.github.io/?https://github.com/conformal/spectrwm/blob/master/spectrwm.html
# NOTE: all rgb color values in this file are in hex! see XQueryColor for examples
# workspace_limit = 22
# focus_mode = default
# focus_close = previous
# focus_close_wrap = 1
# focus_default = last
# spawn_position = next
@jerome-diver
jerome-diver / try QThread list of threads managment
Last active June 7, 2019 18:32
I'm trying to manage a list of threads and from own signal emit self at end of run job, slot connected should remove thread (but it doesn't). Why ?
from PyQt5.QtCore import QObject, QThread, QSemaphore, QReadWriteLock, pyqtSignal, pyqtSlot
import random, time
class Share():
data = dict()
def __init__(self, key, value):
Share.data[key] = value
@staticmethod
def get(key):
return Share.data[key]
@staticmethod