Skip to content

Instantly share code, notes, and snippets.

View jrwren's full-sized avatar
๐Ÿ’ญ
๐Ÿคฏ๐Ÿ’ฏ๐Ÿ‘๐Ÿ”ฅ๐ŸŽ‰๐Ÿคทโ€โ™€๏ธ๐Ÿ˜๐Ÿ˜•๐Ÿ•ด๐Ÿฝ๐Ÿ˜ต๐Ÿ˜ž๐Ÿค•๐Ÿคฎ

Jay R. Wren jrwren

๐Ÿ’ญ
๐Ÿคฏ๐Ÿ’ฏ๐Ÿ‘๐Ÿ”ฅ๐ŸŽ‰๐Ÿคทโ€โ™€๏ธ๐Ÿ˜๐Ÿ˜•๐Ÿ•ด๐Ÿฝ๐Ÿ˜ต๐Ÿ˜ž๐Ÿค•๐Ÿคฎ
View GitHub Profile
@jrwren
jrwren / main.go
Created February 28, 2022 18:08
a slow server useful for testing
package main
import (
"errors"
"io"
"log"
"net/http"
"os"
"strconv"
"time"
@jrwren
jrwren / Dockerfile
Created February 24, 2022 20:18
an unminimized ubuntu with build-essential, openssl, man, jq
FROM ubuntu:20.04
# Lifted from unminimize.
RUN set -e; if [ -f /etc/dpkg/dpkg.cfg.d/excludes ] || [ -f /etc/dpkg/dpkg.cfg.d/excludes.dpkg-tmp ]; then \
echo "Re-enabling installation of all documentation in dpkg..." ;\
if [ -f /etc/dpkg/dpkg.cfg.d/excludes ]; then \
mv /etc/dpkg/dpkg.cfg.d/excludes /etc/dpkg/dpkg.cfg.d/excludes.dpkg-tmp ;\
fi ;\
echo "Updating package list and upgrading packages..." ;\
apt-get update ;\
# apt-get upgrade asks for confirmation before upgrading packages to let the user stop here
@jrwren
jrwren / sad.md
Created February 18, 2022 17:24
a somewhat reasonable python2.7 on macos in 2022

a somewhat reasonable python2.7 on macos in 2022

Yes, this sucks, but look, there are still python2.7 projects out there. Homebrew did the wrong thing by removing their 2.7 forumla.

The system python2.7 doesn't have ability to install virtualenv or even pip. โ˜น๏ธ

That said, use homebrew to install zlib and bzip2 and maybe openssl as deps.

@jrwren
jrwren / readme.md
Created January 14, 2022 16:50
disable restricted, universe, multiverse in ubuntu server/cloud

If you are using a server or cloud image, you may not want to install the necessary packages to get add-apt-repository. /etc/apt/sources.list.d/ is empty by default so you can edit only /etc/apt/sources.list.

Without comments, OOTB docker image looks like this for me:

deb http://archive.ubuntu.com/ubuntu/ bionic main restricted
deb http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted
deb http://archive.ubuntu.com/ubuntu/ bionic universe
deb http://archive.ubuntu.com/ubuntu/ bionic-updates universe
deb http://archive.ubuntu.com/ubuntu/ bionic multiverse
@jrwren
jrwren / Dockerfile
Created October 22, 2021 20:26
Centos6 resurrection Dockerfile
FROM centos:6.7
RUN sed -i 's/#baseurl=http:\/\/mirror/baseurl=http:\/\/vault/;s/mirrorlist/#mirrorlist/' /etc/yum.repos.d/CentOS-Base.repo ;\
curl -LO https://archive.kernel.org/centos-vault/6.10/updates/x86_64/Packages/ca-certificates-2020.2.41-65.1.el6_10.noarch.rpm ;\
rpm -U ./ca-cert*.rpm ;\
rm ca-cert*.rpm ;\
yum -y upgrade ;\
yum install -y yum-utils perl-devel perl-ExtUtils-Embed GeoIP-devel bc \
rpm-build make gcc tar git autoconf automake libtool openssl-devel \
zlib-devel pcre-devel epel-release ;\
@jrwren
jrwren / server.go
Created May 6, 2021 19:17
Slowly responding Go net/http.Server endpoint for testing proxy behavior during shutdown, or connection scalability.
func slow(w http.ResponseWriter, r *http.Request) {
// The slow return of this function is to take 5 minutes.
// We shall return ~1MB total. and use american english dictionary for fun.
f, err := os.Open("/usr/share/dict/words")
if err != nil {
log.Print("couldn't open /usr/share/dict/words")
return
}
defer f.Close()
Is United States a developed or developing country in 2020?
United States is a developing country
What do you know about United States?
How do you imagine this country once you hear its name?
We bet that for the majority of you, United States is a wealthy and advanced country that offers a lot of great opportunities for its citizens as well as expats and is a great place to live.
Youโ€™ve probably made this decision on the basis of United States you saw on the pictures online.
@jrwren
jrwren / jwt.go
Created April 22, 2020 18:33
bosses boss linked me to this... JWT in <50 lines of code.
package main
import (
"crypto"
"crypto/rand"
"crypto/rsa"
"crypto/sha256"
"encoding/base64"
"os"
)
@jrwren
jrwren / jsonmerge.go
Created December 10, 2019 21:39
merge json files into single json with filename minus .log as key
package main
import (
"encoding/json"
"flag"
"log"
"os"
"strings"
)
@jrwren
jrwren / permutecase.go
Created October 25, 2019 15:21
permute case
package main
import (
"fmt"
"strings"
)
func main() {
casePermute("ABCรผ123")
}