Skip to content

Instantly share code, notes, and snippets.

View topalex's full-sized avatar

Alex A. Top topalex

  • Odessa, Ukraine
View GitHub Profile
@topalex
topalex / fancontrol.py
Last active August 15, 2023 21:36
Raspberry PI fan control with hardware PWM
#!/usr/bin/python
# -*- coding: utf-8 -*-
from rpi_hardware_pwm import HardwarePWM
import time
import sys
import syslog
import os
import signal
@topalex
topalex / git_emails.sh
Created June 21, 2021 15:26
Fix wrong emails in git history
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="root@localhost.localdomain"
CORRECT_NAME="Alex.Top"
CORRECT_EMAIL="topalex92@gmail.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@topalex
topalex / add-to-autostart.reg
Last active June 11, 2021 10:32
Auto-start services in WSL
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"WSLAutostart"="C:\\wsl-start.bat"
@topalex
topalex / dirlist.xslt
Last active August 17, 2022 21:55 — forked from wilhelmy/dirlist.xslt
make nginx dirlistings look like lighttpd's through the magic of xslt-transforming xml dirlistings. I don't even.
<?xml version="1.0"?>
<!--
dirlist.xslt - transform nginx's into lighttpd look-alike dirlistings
I'm currently switching over completely from lighttpd to nginx. If you come
up with a prettier stylesheet or other improvements, please tell me :)
-->
<!--
Copyright (c) 2016 by Moritz Wilhelmy <mw@barfooze.de>
@topalex
topalex / mime.html
Last active September 22, 2022 09:43
How to check real mime type of image in javascript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Mime type checker</title>
<script type="text/javascript" src="/jquery.min.js"></script>
<script>
$(function () {
var result = $('div#result');
if (window.FileReader && window.Blob) {
@topalex
topalex / pdns-slave-zone-cleanup-sqlite3.sh
Created October 20, 2017 11:05
Powerdns slave zone cleanup script for sqlite3 backend
#!/bin/bash
#### Config ################################
DATABASE="/var/lib/powerdns/pdns.sqlite3"
DEBUG="no"
#### End of Config #########################
REQUIRED_COMMANDS="