Skip to content

Instantly share code, notes, and snippets.

View akhilman's full-sized avatar
☮️
Peace and Love

AkhIL akhilman

☮️
Peace and Love
View GitHub Profile
@akhilman
akhilman / README.md
Last active March 23, 2024 14:08
IR remote config for X96 TV box
@akhilman
akhilman / webdav-nginx.conf
Last active March 12, 2024 01:27
Fixes for nginx's webdav to work with gvfs clients.
# Define lua functions
init_by_lua_block {
function is_dir(path)
local f = io.open(path, "r")
if not f then
return false
end
local ok, err, code = f:read(1)
f:close()
return code == 21
@akhilman
akhilman / rpc_client_with_futures.py
Created August 29, 2018 16:16
asynchron but without eventloop client for aiozmq rpc.
"""
Based on synchronous implementation of the aiozmq.rpc.RPCClient
https://gist.github.com/derfenix/f18e4a8f0ee9bad738c2b22106a3ad4d
"""
import functools
import logging
import os
import random
import struct
import sys
@akhilman
akhilman / yggdrasil
Last active February 13, 2021 03:25
Yggdrasil init script for SystemV
#!/bin/sh
### BEGIN INIT INFO
# Provides: yggdrasil
# Required-Start: $local_fs
# Required-Stop:
# Should-Start: $network $portmap
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Overlay network
@akhilman
akhilman / antix_f2fs.sh
Last active December 17, 2020 14:57
Convert antix live USB to f2fs
#!/bin/bash
if [ $# -ne 1 ] || ! [ -b $1 ]; then
echo Usage:
echo $(basename $0) boot_part
exit 1
fi
if [ $(whoami) != root ]; then
echo you are not root
@akhilman
akhilman / dropbear
Last active December 17, 2020 14:56
Dropbear init script for SystemV
#!/bin/sh
### BEGIN INIT INFO
# Provides: dropbear
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Lightweight SSH server
# Description: Init script for drobpear SSH server. Edit
# /etc/default/dropbear to configure the server.
@akhilman
akhilman / code-block.ts
Last active May 4, 2020 16:35
code-block web component
import { LitElement, html, css, property, customElement } from "lit-element";
import { unsafeHTML } from "lit-html/directives/unsafe-html";
import * as hljs from "highlight.js";
@customElement("code-block")
export class CodeBlock extends LitElement {
@property() lang = "";
private contentUpdateObserver?: MutationObserver = undefined;
static get styles() {
@akhilman
akhilman / arraybuffer.py
Created November 25, 2017 02:09 — forked from anonymous/arraybuffer.py
numpy array buffer which acts as deque
import enum
import logging
import unittest
import numpy as np
class Side(enum.IntEnum):
NONE = 0
LEFT = 1
import sys
import gi
gi.require_version('Clutter', '1.0')
gi.require_version('Gtk', '3.0')
gi.require_version('GtkClutter', '1.0')
from gi.repository import Clutter # isort:skip
from gi.repository import Gtk # isort:skip
@akhilman
akhilman / ssh proxy
Last active April 17, 2018 15:20
ssh proxy с ограниченным дооступом
создаем пользователя pxy
adduser pxy
закрываем ему доступ к locahost, eth0 заменить на интерфейс смотрящий в интернет
iptables -A OUTPUT -m owner --uid pxy -p tcp -o lo --dport 53 -j ACCEPT # allow dns
iptables -A OUTPUT -m owner --uid pxy -o !eth0 -j DROP # deny localhost
ip6tables -A OUTPUT -m owner --uid pxy -p tcp -o lo --dport 53 -j ACCEPT # allow dns
ip6tables -A OUTPUT -m owner --uid pxy -o !eth0 -j DROP # deny localhost
генерируем ssh ключи, добавляем публичный ключь в ~pxy/.ssh/authorized_keys вставив перед ним: