Skip to content

Instantly share code, notes, and snippets.

@alvalea
alvalea / .vimrc
Created May 25, 2023 12:22
[TerminalProgrammer] vim - IDE
syntax enable
filetype plugin on
let mapleader=" "
set cursorline
set makeprg=nmake
set errorformat=%f(%l):%m
autocmd FileType qf nnoremap <buffer> p :lprev<CR><C-w>w
@alvalea
alvalea / tables_size.sql
Created January 1, 2021 12:26
MySQL show size of all tables
SELECT
table_schema AS `Database`,
table_name AS `Table`,
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM
information_schema.TABLES
ORDER BY
(data_length + index_length)
DESC;
@alvalea
alvalea / main.c
Created December 17, 2020 12:07
C redirect stdout and stderr to syslog using logger command
#include <stdio.h>
#include <unistd.h>
int main()
{
// Pipe open logger command in another process (sh -c logger)
FILE *fl;
fl = popen("logger","w");
if(fl == NULL)
return 1;
@alvalea
alvalea / main.go
Created October 4, 2020 18:56
Read key value configuration into a map
package main
import (
"fmt"
"regexp"
)
var text =
`
"TMLINK" = "ENABLED";
@alvalea
alvalea / index.html
Created July 15, 2020 16:23
css dropdown search bar
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.dropbtn {
background-color: #4CAF50;
color: white;
padding: 16px;
font-size: 16px;
@alvalea
alvalea / rust_def_coercion.rs
Last active August 29, 2015 14:17
Rust references example
fn main() {
let x = Box::new(5);
let p = &x;
let pp : &i32 = &x;
println!("&x: {:p}", &x);
println!("p: {:p}", p);
println!("pp: {:p}", pp);
}