Skip to content

Instantly share code, notes, and snippets.

@movalex
movalex / win-125x.lua
Created February 26, 2023 21:02 — forked from Egor-Skriptunoff/win-125x.lua
String converter between Windows ANSI and UTF-8 encodings
---------------------------------------------------------------------
-- Converter between win-125x and UTF-8 strings
---------------------------------------------------------------------
-- Written in pure Lua, compatible with Lua 5.1-5.4
-- Usage example:
-- require("win-125x")
-- str_win = utf8_to_win(str_utf8)
-- str_utf8 = win_to_utf8(str_win)
---------------------------------------------------------------------

Compile Samba on macos 12 (Monterey)

git clone https://git.samba.org/samba.git

brew install cmake gnutls jansson libarchive openssl pkg-config python@3.11
brew install readline && brew link --force readline

export CPPFLAGS="-I/usr/local/opt/libarchive/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl@3/include"
export LDFLAGS="-L/usr/local/opt/libarchive/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/openssl@3/lib"
@movalex
movalex / toggle_swap.sh
Last active September 6, 2022 09:18 — forked from Jekis/toggle_swap.sh
Empty swap. Clear swap. Move swap to RAM. Ubuntu.
#!/bin/bash
function calc_percentage () {
mem="$1"
total="$2"
if [[ $mem -gt 0 ]]; then
return $((mem * 100 / total))
else
return 0
fi
@movalex
movalex / python.vim
Created April 10, 2019 10:37 — forked from mdzhang/python.vim
Vim - SQL highlighting in Python strings
" Put this in ~/.vim/after/syntax/python.vim
" Slight tweaks to https://lonelycoding.com/can-i-use-both-python-and-sql-syntax-highlighting-in-the-same-file-in-vim/
" Needed to make syntax/sql.vim do something
unlet b:current_syntax
" Load SQL syntax
syntax include @SQL syntax/sql.vim
@movalex
movalex / Blocker_update.sh
Last active April 17, 2018 07:19 — forked from jhochwald/Blcoker_update.sh
Cron to update the IPTables Blocker
#!/usr/bin/env bash
# Cron to update the IPTables Blocker
# Now works with Raspberry Pi Raspbian Jessy
# Define some defaults
IPTABLES='/sbin/iptables'
BLOCKLIST='/tmp/enatec_blocked.txt'
# Get the latest List
@movalex
movalex / removecompletedtorrents.sh
Created June 14, 2016 22:48 — forked from bulljit/removecompletedtorrents.sh
Transmission-Daemon: Remove Completed Torrents
#!/bin/sh
# script to check for complete torrents in transmission folder, then stop and move them
# either hard-code the MOVEDIR variable here…
MOVEDIR=/home/mjdescy/media # the folder to move completed downloads to
# …or set MOVEDIR using the first command-line argument
# MOVEDIR=%1
# use transmission-remote to get torrent list from transmission-remote list
# use sed to delete first / last line of output, and remove leading spaces
# use cut to get first field from each line