Skip to content

Instantly share code, notes, and snippets.

View deomorxsy's full-sized avatar
🐚
λx.x

deomorxsy

🐚
λx.x
  • PE, Brasil
  • 01:08 (UTC -03:00)
View GitHub Profile
@deomorxsy
deomorxsy / sl_port-v1.lua
Last active October 29, 2023 19:11
simple nvim lua statusline, old version, lil broken
vim.opt.laststatus = 2
vim.opt.statusline = sl_values
-- local sl_values
-- statusline functions
local function StatuslineMode()
local mode = vim.fn.mode()
if mode == 'n' then
@deomorxsy
deomorxsy / sed_varexp.md
Created October 11, 2023 22:13
sed variable expansion and its relation with delimiters (you can't use the same character for both).

source

[asari@asari nvim]$ sed -e "s/p3hp_placeholder/$roco/g" mock.lua
sed: -e expressão #1, caractere 21: opção desconhecida para o comando `s' (s///?)
[asari@asari nvim]$
[asari@asari nvim]$
[asari@asari nvim]$
[asari@asari nvim]$ sed -e "s@p3hp_placeholder@$roco@g" mock.lua
require("user.remap")
require("tools")
@deomorxsy
deomorxsy / ffmpeg-bottom-crop.sh
Last active July 5, 2023 21:40
crop the height of video at the bottom using FFMPEG.
#!/usr/bin/bash
# cut 30 rows from the height at the bottom of the video
ffmpeg -i ./input.data -vf crop=iw:ih-30:0:10 -c:a copy ./output.mp4
@deomorxsy
deomorxsy / Containerfile_sparklyr-demo
Last active July 5, 2023 22:13
Custom Containerfile for containerized sparklyr environment to run on spark-on-k8s-operator, an operator for Kubernetes/K8S, tested on K3S (k3s version v1.23.6+k3s1 (418c3fa8); go version go1.17.5). Practical deploy example: https://github.com/deomorxsy/rrkgo/blob/main/core/Dockerfile
FROM gcr.io/datamechanics/spark:3.0.2-hadoop-3.2.0-java-8-scala-2.12-python-3.8-dm13
ARG R_VERSION="4.0.4"
ARG LIBARROW_BINARY="true"
ARG RSPM_CHECKPOINT=2696074
ARG CRAN="https://packagemanager.rstudio.com/all/__linux__/focal/${RSPM_CHECKPOINT}"
USER root
@deomorxsy
deomorxsy / second-chance_PR.py
Created January 12, 2022 02:36
second chance page replacement policy/algorithm
import sys
from threading import Thread
import time
#def only_a_second_chance():
def second_chance(page_requests, mem_size, page_faults, m, thread_name):
#mem_size = int(sys.argv[1]) # N, physical memory
mem_size = mem_size
@deomorxsy
deomorxsy / express-server.md
Last active September 28, 2021 21:47
express server with nodejs to serve a web page inside a Termux environment.

Servindo servidor web com páginas estáticas no ambiente Termux

tags: nodejs, express

Temos algumas alternativas para rodar páginas web escritas dentro do ambiente Termux. Uma delas é utilizando o nodejs, que é o escopo desse tutorial.

  1. Instale nodejs caso ainda não tenha feito isso
; pkg install nodejs
@deomorxsy
deomorxsy / dados-2.R
Last active October 1, 2021 00:07
monte carlo methods
#Vectorized code for monte carlo dart simulation
throws = 100
landed = 0 #landed in circle
#throws=100
x = runif(n=throws, min=-1, max=1)
y = runif(n=throws, min=-1, max=1)
soma_quadrados <- (x^2) + (y^2)
@deomorxsy
deomorxsy / life-utf8.c
Created April 25, 2021 22:29 — forked from katef/life-utf8.c
XBM to UTF-8 braille image things
/*
* John Conway's Game of Life.
*
* This is written for POSIX, using Curses. Resizing of the terminal is not
* supported.
*
* By convention in this program, x is the horizontal coordinate and y is
* vertical. There correspond to the width and height respectively.
* The current generation number is illustrated when show_generation is set.
*
@deomorxsy
deomorxsy / setxkbmap.md
Created March 28, 2021 12:57
configure keyboard to br-abnt2 pattern with setxkbmap

Setting up keyboard to br-abnt2:

[asari@asari ~]$ setxkbmap -print -verbose 10 
Setting verbose level to 10 
locale is C 
Trying to load rules file ./rules/evdev... 
Trying to load rules file /usr/share/X11/xkb/rules/evdev... 
Success. 
Applied rules from evdev: 
rules: evdev