Skip to content

Instantly share code, notes, and snippets.

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

deomorxsy

🐚
λx.x
  • PE, Brasil
  • 05:47 (UTC -03:00)
View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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 / 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 / update-git-fork.md
Last active March 6, 2024 00:33
commands to update the git repo fork from the upstream
# check the origin
git ls-remote --get-url origin

# add remote
## for configured SSH environments as remote connection:
git remote add upstream [email protected]:{user/org}/repo.git
## for for configured HTTPS environments as remote connection:
git remote add upstream https://github.com/{user/org}/repo.git
@deomorxsy
deomorxsy / jar.md
Last active April 7, 2024 19:46
handling jar compressed files

Handling jar compressed files

Quick notes about handling jars on the CLI in maven projects with java. Dependencies:

  • jar
  • unzip
  • mvn

generate jar passing the directory the pom.xml is located:

; mvn package -f ./server/
@deomorxsy
deomorxsy / virtual_storage.md
Last active April 8, 2024 05:25
storage virtualization handling for QEMU and others

Virtual Storage for QEMU

quick notes about the different ways to handle storage virtualization for QEMU

0. mknod

[31/03/2024 10:07] mknod can be used for creating block or character special files, such asdevice nodes (special directories). It is an alternative for the powerful dd command which could wipe your root system at runtime.