Skip to content

Instantly share code, notes, and snippets.

Avatar

Vinay Sajip vsajip

View GitHub Profile
@vsajip
vsajip / Server.kt
Created Jun 9, 2022 — forked from Silverbaq/Server.kt
A simple socket-server written in Kotlin
View Server.kt
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
For Opalstack, configure Nginx and Apache proxy-port "private stack" applications to proxy to a static site with or without PHP.
View private_stack.py
#!/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
Test GnuPG verification of a detached signature
View test-detached-verification.bash
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
View wordle-nyt-allowed-guesses.txt
aahed
aalii
aargh
aarti
abaca
abaci
abacs
abaft
abaka
abamp
@vsajip
vsajip / wordle-answers-alphabetical.txt
Created Apr 6, 2022 — 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
View wordle-answers-alphabetical.txt
aback
abase
abate
abbey
abbot
abhor
abide
abled
abode
abort
@vsajip
vsajip / README.md
Created Mar 23, 2022 — forked from avoidik/README.md
Compile vaultwarden (ex. bitwarden_rs) on Raspberry Pi
View README.md

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 Feb 5, 2022 — forked from Deco/deepcopy.lua
Lua Non-recursive Deep-copy
View deepcopy.lua
--[[ 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 Jan 26, 2022
Test files for diagnosing pynsist issue #243
View build.py
#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 Jan 5, 2022 — 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.
View email_header_parser.rb
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 Dec 24, 2021 — forked from piscisaureus/pr.md
Checkout github pull requests locally
View pr.md

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: