Skip to content

Instantly share code, notes, and snippets.

View Luctins's full-sized avatar
🦀

Lucas Martins Mendes Luctins

🦀
View GitHub Profile
@Luctins
Luctins / gSync.sh
Created October 13, 2017 22:53
simple script for cli gdrive sinching with grive tool
cd ~/googleDrive
grive -V --log-http logs/synclogHTTP.txt -l logs/synclog.txt -P
@Luctins
Luctins / findColor.py
Created December 3, 2017 01:36
OpenCV experiment
import cv2 as cv
import numpy as np
def nothing(x):
pass
#img = cv.imread('fil_img.jpg')
cap = cv.VideoCapture(0)
@Luctins
Luctins / debug.h
Last active July 9, 2019 17:45
Pack of helper and debug macros for C
#ifndef DEBUG_HELPER_H
#define DEBUG_HELPER_H
/**
@file debug_helper.h
@author Lucas Martins Mendes
@brief debug macros
*/
/*--Used to paste tokens together--*/
@Luctins
Luctins / dithering.pde
Created February 24, 2020 17:42
Dithering code example
PImage img;
int x_max = 0, y_max = 0, _x_max = 0, _y_max = 0 ;
final int inc = 10;
final int color_num = 4;
final float e[] = {7.0/16.0, 3.0/16.0, 5.0/16.0, 1.0/16.0};
void setup()
{
@Luctins
Luctins / setdisplaybrightness.sh
Created December 15, 2020 12:44
ddcutil monitor brightness adjust alias
alias setmonitorbrightness='sudo ddcutil --display 1 setvcp 10'
@Luctins
Luctins / print_num.c
Created December 17, 2020 15:00
Routine for printing numbers on platforms that have no printf (this one specifically is for NIOS II), DEBUG_OUTPUT is your the string printing routine of choice.
/**
@brief print a number as a decimal (because of memory constraints the limited printf only works for hex and strings, no decimals).
*/
void print_num(alt_u32 num)
{
char buff[15],tmp;
char * str = buff;
alt_u8 dp=0; /*number of decimal places*/
if(num == 0)
{
@Luctins
Luctins / insert-image.el
Last active January 26, 2021 19:31
orgmode image inserter
(defun org-insert-image-from-clipboard ()
"Take a screenshot into a time stamped unique-named file in the
same directory as the org-buffer and insert a link to this file. Depends in X.org to work (for now)"
(interactive)
(setq folder-name (concat (file-name-sans-extension (buffer-file-name)) "-orgimg"))
(message folder-name)
(if (not (file-directory-p folder-name))
(make-directory folder-name nil))
(setq filename
(concat
@Luctins
Luctins / stophd.sh
Created March 16, 2021 20:49
Alias to make silly USB hard drives stop spinning
alias stophd='sudo hdparm -B1' #<path to drive>
#Usage: stophd /dev/sdb
# Settle time
# @author: Lucas Martins Mendes - contact@luctins.me
function ret = settle_t(F, X = [], T = [], tolerance=0.02)
if size(X) == [0 0] || size(T) == [0 0]
[X, T] = step(F);
endif
_X = flip(X);
_T = flip(T);
s_top = (1+tolerance)*dcgain(F);
s_bot = (1-tolerance)*dcgain(F);
@Luctins
Luctins / quartus20.01.desktop
Created May 28, 2021 12:29
Quartus .desktop file
[Desktop Entry]
Type=Application
Name=Quartus Intel FPGA Lite 20.1
Exec=/home/mluctins/.intelFPGA/20.1/quartus/bin/quartus
Terminal=false
GenericName=EDA
Icon=/home/mluctins/.local/share/icons/quartus.ico
Categories=Development;EDA;
StartupWMClass=Quartus