Skip to content

Instantly share code, notes, and snippets.

View denisdemaisbr's full-sized avatar

DENIS DOS SANTOS SILVA denisdemaisbr

View GitHub Profile
---
--- license: public domain
--- author: denis dos santos silva
--- date : 20/05/17
--- lua 5.1+
---
function processa(data)
local _c3 = {};
local _c;
/*
c, ansi c, ansi c99, exemplo, faculdade, notas, alunos, ...
aceita input pelo teclado ou via argumentos
https://groups.google.com/g/ccppbrasil/c/WIJkUFWlcNg
@denisdemaisbr
denisdemaisbr / reset_act.bat
Created March 26, 2022 14:28
how reset windows ntfs permissions (be careful)
@echo off
echo "be careful this can explode your disk"
echo "hit enter to continue"
pause
d:
cd d:\docs
takeown /r /f *
ICACLS * /T /Q /C /RESET
pause
@denisdemaisbr
denisdemaisbr / gitea-passwd.sh
Created March 26, 2022 18:26
how change password of gitea user's
#!/bin/sh
set -e
su gitea
cd /home/git/gitea
./gitea --version
./gitea admin change-password --username your-login --password your-new-super-password
exit 0
@denisdemaisbr
denisdemaisbr / ffmpeg-to-480p.sh
Last active April 7, 2022 00:45 — forked from blacklee/ffmpeg-to-480p.sh
ffmpeg convert video to 480p
#!/bin/sh
set -e
# TODO:
# - check arguments
# - check file
ffmpeg -i $1 -s hd480 -c:v libx264 -crf 23 -c:a aac -strict -2 `basename $1 .mp4`_480p.mp4
@denisdemaisbr
denisdemaisbr / ipfs-on-raspberry-pi.md
Created May 8, 2022 08:28 — forked from peterVG/ipfs-on-raspberry-pi.md
Put IPFS decentralized storage on your Raspberry Pi with USB storage

I put IPFS on a Raspberry Pi and so should you!

Total cost of joining the decentralized storage revolution with your own lo-fi node: $124 USD

raspberry-ipfs

@denisdemaisbr
denisdemaisbr / client-syslog.sh
Last active March 17, 2023 19:32
sample usage of syslog using syslog4j tested with java 1.8 (openjdk version "1.8.0_362")
#!/bin/sh
#
# download package from http://syslog4j.org/
# check also https://manpages.ubuntu.com/manpages/xenial/man1/logger.1.html
#
java -cp syslog4j-0.9.46-bin.jar \
org.productivity.java.syslog4j.server.SyslogServerMain \
-h 127.0.0.1 \
-p 9999 \
@denisdemaisbr
denisdemaisbr / test.sql
Created May 26, 2023 19:49
sqlite3 insert or replace
-- insert or replace sqlite 3.x
create table config( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, key text, value text );
insert into config values (1, "fg", "#ff00ff" );
insert or replace into config(id, key, value) values ((select id from config where key = "bg"), "bg", "0x00ff00");
SELECT * FROM config;
$ sqlite3 < test.sql
SQLite version 3.34.0 2020-12-01 16:14:00
1|fg|#ff00ff
@denisdemaisbr
denisdemaisbr / rl_helper.php
Created May 27, 2023 13:35
fix Got error 'PHP message: PHP Fatal error: Unparenthesized `a ? b : c ? d : e` is not supported. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` in public_html/system/helpers/url_helper.php on line 162'
/*
php -v
PHP 8.0.28 (cli) (built: Feb 14 2023 18:33:29) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.28, Copyright (c) Zend Technologies
with Zend OPcache v8.0.28, Copyright (c), by Zend Technologies
grep CI_VERSION system/core/CodeIgniter.php
define('CI_VERSION', '3.0.0');
*/
@denisdemaisbr
denisdemaisbr / str_split.lua
Last active June 23, 2023 11:26
split a string by length like str_split() from php ported to lua
--
-- based on https://www.php.net/manual/en/function.str-split.php
-- feel to free to validate/adjust to uses asserto/error
--
-- Denis Dos Santos Silva
--
local function str_split(str, length)
local result = {}
local index = 1