Skip to content

Instantly share code, notes, and snippets.

View vsajip's full-sized avatar

Vinay Sajip vsajip

View GitHub Profile
@vsajip
vsajip / Server.kt
Created June 9, 2022 15:56 — forked from Silverbaq/Server.kt
A simple socket-server written in Kotlin
package dk.im2b
import java.io.OutputStream
import java.net.ServerSocket
import java.net.Socket
import java.nio.charset.Charset
import java.util.*
import kotlin.concurrent.thread
@vsajip
vsajip / private_stack.py
Created May 14, 2022 12:00
For Opalstack, configure Nginx and Apache proxy-port "private stack" applications to proxy to a static site with or without PHP.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2022 Red Dove Consultants Limited.
#
# License: Apache 2.0, see https://www.apache.org/licenses/LICENSE-2.0
#
# Gratefully based on work by Ryan Sanden and Sean Fulmer at
#
# https://github.com/rsanden/userspace-fpm-installer
@vsajip
vsajip / test-detached-verification.bash
Created May 7, 2022 23:26
Test GnuPG verification of a detached signature
command_status() {
if [ $1 = '0' ]; then
echo $'\e[1;32m'Result: Success$'\e[0m'
else
echo $'\e[1;31m'Result: Failure \(exit code = $1\)$'\e[0m'
fi
}
GPG=gpg2
rm -rf keys
aahed
aalii
aargh
aarti
abaca
abaci
abacs
abaft
abaka
abamp
@vsajip
vsajip / wordle-answers-alphabetical.txt
Created April 6, 2022 20:00 — forked from cfreshman/wordle-answers-alphabetical.txt
Wordle answers from source code in alphabetical order. And if you write a solver, here's a leaderboard! https://freshman.dev/wordle/#/leaderboard NYTimes version: https://gist.github.com/cfreshman/a7b776506c73284511034e63af1017ee
aback
abase
abate
abbey
abbot
abhor
abide
abled
abode
abort
@vsajip
vsajip / README.md
Created March 23, 2022 09:04 — forked from avoidik/README.md
Compile vaultwarden (ex. bitwarden_rs) on Raspberry Pi

How to build and install vaultwarden (ex. bitwarden_rs) on Raspberry Pi

Steps

Prepare prerequisites

sudo apt-get update
sudo apt-get install -y --no-install-recommends build-essential libmariadb-dev-compat libpq-dev libssl-dev pkgconf
@vsajip
vsajip / deepcopy.lua
Created February 5, 2022 09:12 — forked from Deco/deepcopy.lua
Lua Non-recursive Deep-copy
--[[ deepcopy.lua
Deep-copy function for Lua - v0.2
==============================
- Does not overflow the stack.
- Maintains cyclic-references
- Copies metatables
- Maintains common upvalues between copied functions (for Lua 5.2 only)
TODO
@vsajip
vsajip / build.py
Created January 26, 2022 15:14
Test files for diagnosing pynsist issue #243
#import distlib.scripts
import io
import os.path as osp
import sys
# from distlib import __version__ as distlibversion
from pathlib import Path
from zipfile import ZipFile
SCRIPT = """import sys
@vsajip
vsajip / email_header_parser.rb
Created January 5, 2022 05:10 — forked from pmarreck/email_header_parser.rb
Superfast email header parser in Ruby, using regular expressions. This solution is 250 times faster than using the "Mail" gem. :O Time with my regex: 0.063965 seconds Time with Mail gem: 16.327161 seconds Note that I included some encoding-fix code. YMMV and encoding fixes are all debatable or fail in some corner case.
require 'ap'
require 'mail'
# String monkeypatch
# This is one of many possible "encoding problem" solutions. It's actually an intractable problem
# but you'd have to read "Gödel, Escher, Bach" to understand why...
class String
def clean_utf8
# self.force_encoding("UTF-8").encode("UTF-16BE", :invalid=>:replace, :replace=>"?").encode("UTF-8")
unpack('C*').pack('U*') if !valid_encoding?
@vsajip
vsajip / pr.md
Created December 24, 2021 13:59 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: