Skip to content

Instantly share code, notes, and snippets.

@ZiTAL
ZiTAL / example.sh
Created September 26, 2023 11:22
config external smtp to setup debian to send mail
echo "Testing msmtp from ${HOSTNAME} with mail command" | mail -s "hi there" zital@riseup.net
@ZiTAL
ZiTAL / index.html
Last active September 10, 2023 12:11
js: videojs hls example
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>videojs-contrib-hls embed</title>
<link href="https://vjs.zencdn.net/8.0.4/video-js.css" rel="stylesheet">
<script src="https://vjs.zencdn.net/8.0.4/video.min.js"></script>
<script src="https://unpkg.com/@videojs/http-streaming@3.2.0/dist/videojs-http-streaming.min.js"></script>
@ZiTAL
ZiTAL / index.php
Last active August 23, 2023 08:29
php: minecraft server log output
<?php
$file_name = 'latest.log';
$f_mod = date('Y-m-d H:i:s', filemtime($file_name));
$log_file = file_get_contents($file_name);
$lines = preg_split("/\n/", $log_file);
$log = '';
foreach($lines as $line)
{
// [22:41:42] [User Authenticator #7/INFO]: UUID of player arkkuso is aa1111a1-a1aa-1111-1a1a-aa11a1a111aa
@ZiTAL
ZiTAL / bluetooth.sh
Created July 11, 2023 11:54
Bash: bluetooth script to connect automatically
#!/bin/bash
# Specify the device MAC address
DEVICE_MAC="F8:DF:15:C7:1C:3D"
# Start bluetoothctl and connect to the device
bluetoothctl << EOF
power on
agent on
connect $DEVICE_MAC
@ZiTAL
ZiTAL / index.py
Last active June 30, 2023 13:15
python: open llama
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# pip3 install
# 3B
# https://huggingface.co/TheBloke/orca_mini_3B-GGML/tree/main
# 7B
# https://huggingface.co/TheBloke/open-llama-7b-open-instruct-GGML/tree/main
@ZiTAL
ZiTAL / keys
Last active May 30, 2023 08:46
fluxbox print screen
# .fluxbox/keys
# ...
#
# comment the command you are not going to use
#
# using scrot with 5 seconds delay
Print :Exec scrot -b -d 5 image-$(date +"%Y-%m-%d-%H-%I-%M-%N.png") -e 'mv $f ~/Pictures/'
# using import instant screenshot
Print : ExecCommand /usr/bin/import -window root ~/Pictures/image-$(date +"%Y-%m-%d-%H-%I-%M-%N").png
# ...
@ZiTAL
ZiTAL / README.md
Created May 25, 2023 10:18
ASUS RT-AC68U: Izarkom SERCOMM router-a bridge moduan jarri, gure router neutro-a konfiguratzeko gida

ASUS RT-AC68U: Izarkom SERCOMM router-a bridge moduan jarri, gure router neutro-a konfiguratzeko gida

  1. SERCOMM ETH1 sare portua ordenagailura konketatu.
  2. SERCOMM router-aren konfigurazioan sartu: http://192.168.1.1 SERCOMM
  3. Configuración -> LAN Switch -> Modo: Bridge (nivel 2).
  4. Aplicar.
  5. SERCOMM botoia sakatuz reseteatu.
  6. SERCOMM ETH1 portua ASUS-en WAN portura konektatu
  7. ASUS ETH1 ordenagailura konektatu.
@ZiTAL
ZiTAL / sasi-chat-gpt.sh
Last active May 5, 2023 08:06
local-chat-gpt
su
chown -R pi:pi /opt
exit
cd /opt
curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-$(uname)-$(uname -m).sh"
bash Mambaforge-Linux-aarch64.sh
# /opt/mambaforge
su
ln -s /opt/mambaforge/bin/conda /usr/local/bin/conda
@ZiTAL
ZiTAL / certbot.conf
Created April 12, 2023 10:56
certbot: manual renew certificate
server {
include /etc/nginx/vhost.conf.d/*.conf;
server_name zital.freemyip.com zital-pi.no-ip.org pi4 amule.zital.freemyip.com bermiotarra.zital.freemyip.com blog.zital.freemyip.com clock-canvas-js.zital.freemyip.com downloads.zital.freemyip.com itzultzaile-neuronala.zital.freemyip.com matematika-js.zital.freemyip.com sotapatroi.zital.freemyip.com transmission.zital.freemyip.com vpn.zital.freemyip.com mc.zital.freemyip.com
root /var/www/html;
location / {
allow all;
}
}
@ZiTAL
ZiTAL / Main.php
Last active March 14, 2023 12:01
Laravel: Eloquent connect 2 tables using hasOneThrough
<?php
// We would like to get Destiny's table data, using Main's information and using the intermediate table Intermediate
App;
use Illuminate\Database\Eloquent\Model;
class Main extends Model
{
public function destiny()
{
return $this->hasOneThrough(