Skip to content

Instantly share code, notes, and snippets.

View jontsai's full-sized avatar
😎
h4x0ring

Jonathan Tsai jontsai

😎
h4x0ring
View GitHub Profile
@jontsai
jontsai / installing-emacs-from-source-on-debian.txt
Last active February 29, 2024 09:36 — forked from zoliky/installing-emacs-from-source-on-debian.txt
Installing Emacs 29.2 from source on Debian v5 (v12?)
# https://ioflood.com/blog/install-emacs-command-linux/
Installation
------------
1. Install the build dependencies for Emacs:
$ sudo apt build-dep emacs
$ sudo apt install libtree-sitter-dev
import random
class TemperamentalClass(type):
@classmethod
def __instancecheck__(cls, other):
return random.choice([True, False])
class MyClass(metaclass=TemperamentalClass):
pass
@jontsai
jontsai / rect-starlink-cable-hack.md
Created October 6, 2022 23:51 — forked from darconeous/rect-starlink-cable-hack.md
Hacking the Rectangular Starlink Dishy Cable
@jontsai
jontsai / fields.py
Created September 6, 2022 00:32 — forked from atabary/fields.py
CompressedBinaryField for Django
import bz2
import StringIO
from django.db import models
from django.utils.six import with_metaclass
class CompressedBinaryField(with_metaclass(models.SubfieldBase, models.BinaryField)):
description = "A binary field with bzip2 compression"
@jontsai
jontsai / install-percona5.7.sh
Created August 13, 2022 21:17 — forked from acip/install-percona5.7.sh
Install Percona 5.7 (drop in MysqSql 5.7 replacement) on Ubuntu 22.04 Jammy
wget https://downloads.percona.com/downloads/Percona-Server-5.7/Percona-Server-5.7.38-41/binary/debian/focal/x86_64/libperconaserverclient20_5.7.38-41-1.focal_amd64.deb
wget https://downloads.percona.com/downloads/Percona-Server-5.7/Percona-Server-5.7.38-41/binary/debian/focal/x86_64/percona-server-client-5.7_5.7.38-41-1.focal_amd64.deb
wget https://downloads.percona.com/downloads/Percona-Server-5.7/Percona-Server-5.7.38-41/binary/debian/focal/x86_64/percona-server-common-5.7_5.7.38-41-1.focal_amd64.deb
wget https://downloads.percona.com/downloads/Percona-Server-5.7/Percona-Server-5.7.38-41/binary/debian/focal/x86_64/percona-server-server-5.7_5.7.38-41-1.focal_amd64.deb
apt purge mysql-server* -y
apt autoremove -y
apt install mysql-common debsums libmecab2
wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1l-1ubuntu1.6_amd64.deb
dpkg -i libssl1.1_1.1.1l-1ubuntu1.6_amd64.deb
@jontsai
jontsai / eol-at-eof.md
Created April 11, 2022 16:30 — forked from camh-/eol-at-eof.md
Please add newlines at end of files

See https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline

A newline in a text file is a terminator, not a separator. This means each line should have a newline at the end of it, including the last line of the file.

Many editors automatically add the newline at the end of the file. Some do not. If you can configure your editor to ensure there is always a newline at the end of every line, please do so.

Because many editors do add this newline, if you commit a text file without it, when someone else edits the file, their editor will (correctly) add the newline. This causes a spurious diff in the file. Spurious

@jontsai
jontsai / git-permission-reset
Created January 19, 2022 09:53 — forked from jtdp/gist:5443498
Revert file permission changes in local git repository.. Very useful when you change permissions due to working on a samba share.Lifted from: http://stackoverflow.com/questions/2517339/git-how-to-recover-the-file-permissions-git-thinks-the-file-should-be
git diff -p \
| grep -E '^(diff|old mode|new mode)' \
| sed -e 's/^old/NEW/;s/^new/old/;s/^NEW/new/' \
| git apply
@jontsai
jontsai / apache_ssl.md
Created December 15, 2021 03:58 — forked from GAS85/apache_ssl.md
Apache 2.4.18+ with Letsencrypt on Ubuntu 20.04 - SSL config for A+ on SSLLabs.com

Prerequisites

  • Ubuntu 20.04 (18.04, 16.04 works the same)
  • Apache 2.4.18 or higher
  • OpenSSL 1.0.2g-1ubuntu4.10 or higher
  • e.g. LetsEncrypt certificate
OS: Ubuntu 20.04 Apache/2.4.18 1.0.2g-1ubuntu4.10 +
@jontsai
jontsai / country_date_formats.csv
Created August 18, 2021 03:32 — forked from mlconnor/country_date_formats.csv
Listing of countries with their preferred date formats, ISO3166 code, ISO629-2
ISO 3166 Country Code ISO639-2 Country Code Country ISO 3166 Country Code ISO639-2 Lang Language Date Format
ALB AL Albania sqi sq Albanian yyyy-MM-dd
ARE AE United Arab Emirates ara ar Arabic dd/MM/yyyy
ARG AR Argentina spa es Spanish dd/MM/yyyy
AUS AU Australia eng en English d/MM/yyyy
AUT AT Austria deu de German dd.MM.yyyy
BEL BE Belgium fra fr French d/MM/yyyy
BEL BE Belgium nld nl Dutch d/MM/yyyy
BGR BG Bulgaria bul bg Bulgarian yyyy-M-d
BHR BH Bahrain ara ar Arabic dd/MM/yyyy
@jontsai
jontsai / tmux-protocol-fix.txt
Last active May 5, 2020 23:07 — forked from eculver/protocol-fix.txt
How to deal with tmux "protocol version mismatch"
$ tmux attach
protocol version mismatch (client 7, server 6)
$ pgrep tmux
3429
$ /proc/3429/exe attach