Skip to content

Instantly share code, notes, and snippets.

@tripleee
tripleee / emacs-python-repl.md
Created December 1, 2023 10:39
Python REPL in Emacs, demonstrating C-o flush-output

Here is a brief video demonstrating M-x shell and in particular the use of C-c C-o (comint-delete-output) in both the shell and a Python REPL.

Screen.Recording.2023-12-01.at.12.27.50.mov
@tripleee
tripleee / prosus.md
Last active June 5, 2023 13:14
Prosus letter re: Stack Exchange moderation strike

Here's the email I sent.

From: tripleee
To: communications (at) naspers (dot) com (sic)
Subject: Stack Overflow / Stack Exchange moderation strike

Sorry for writing to your press address. I could find no more suitable address under "contact us" on your web site www.prosus.com.

I'm writing as a concerned user of Stack Overflow and the network of sites they operate as Stack Exchange, Inc.

@tripleee
tripleee / friday.py
Last active December 2, 2022 11:22
Amount of bad questions on Stack Overflow per weekday
import csv
import sys
wd = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
# https://data.stackexchange.com/stackoverflow/query/1681084
with open(sys.argv[1], "r") as csvfile:
reader = csv.reader(csvfile)
header = True
for row in reader:
@tripleee
tripleee / ruawk.txt
Created September 2, 2022 12:12
ruawk.txt
bash$ docker run --rm -it debian
root@6d9fd42e99af:/# apt-get update
Get:1 http://security.debian.org/debian-security bullseye-security InRelease [48.4 kB]
Get:2 http://deb.debian.org/debian bullseye InRelease [116 kB]
Get:3 http://security.debian.org/debian-security bullseye-security/main amd64 Packages [180 kB]
Get:4 http://deb.debian.org/debian bullseye-updates InRelease [44.1 kB]
Get:5 http://deb.debian.org/debian bullseye/main amd64 Packages [8182 kB]
Get:6 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [2596 B]
Fetched 8573 kB in 2s (3663 kB/s)
Reading package lists... Done
@tripleee
tripleee / pypodcasts.md
Created May 17, 2022 06:54
Python podcasts

Here are the Python podcasts I am aware of.

The exposition is oriented more towards developer gossip because that was the context in which I was asked.

I link to Castro because that's convenient for me; I hope the links are not too unwieldy for others. (If you are looking for a podcast player, I don't hesitate to recommend Castro, though!)

Talk Python to Me

@tripleee
tripleee / rescan5min.py
Last active May 11, 2022 13:16
Smokey experiment, rescan after 5min
import json
import time
from datetime import datetime, timedelta
import websocket
import requests
from bodyfetcher import BodyFetcher
from globalvars import GlobalVars
from datahandling import load_files

Here's a brief demo of metasmoke and how slow it is for me right now.

I click in the boxes repeatedly while waiting until it finally becomes responsive.

I had to click twice to get to the search page, I have observed that repeatedly in the past so I don't think it was my own clumsiness with the mouse.

Screen.Recording.2022-04-29.at.18.03.37.mov
@tripleee
tripleee / dump.sh
Created October 28, 2021 18:22
MySQL: dump posts.json from metasmoke
#!/bin/sh
mysql --silent --raw --user root -ppassword metasmoke -e "select json_object('id', id, 'title', title, 'body', body, 'link', link, 'post_creation_date', post_creation_date, 'created_at', created_at, 'updated_at', updated_at, 'site_id', site_id, 'user_link', user_link, 'username', username, 'why', why, 'user_reputation', user_reputation, 'score', score, 'upvote_count', upvote_count, 'downvote_count', downvote_count, 'stack_exchange_user_id', stack_exchange_user_id, 'is_tp', is_tp, 'is_fp', is_fp, 'is_naa', is_naa, 'revision_count', revision_count, 'deleted_at', deleted_at, 'smoke_detector_id', smoke_detector_id, 'autoflagged', autoflagged, 'tags', tags, 'feedbacks_count', feedbacks_count, 'native_id', native_id) from posts" >posts.json
@tripleee
tripleee / rails.log
Created October 20, 2021 20:20
metasmoke rails db:seed failure
#20 18.45 + rails db:seed
#20 22.52 /usr/src/app/config/initializers/appconfig.rb:3: warning: already initialized constant AppConfig
#20 22.52 /usr/src/app/config/application.rb:50: warning: previous definition of AppConfig was here
#20 24.28 rails aborted!
#20 24.29 NoMethodError: undefined method `count' for nil:NilClass
#20 24.29 /usr/src/app/app/helpers/sites_helper.rb:9:in `update_sites'
#20 24.29 /usr/src/app/db/seeds.rb:16:in `<top (required)>'
#20 24.29 /usr/local/bundle/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:285:in `load'
#20 24.29 /usr/local/bundle/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:285:in `block in load'
#20 24.29 /usr/local/bundle/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:257:in `load_dependency'
@tripleee
tripleee / Unicode_KrutiDev_converter.py
Last active November 1, 2023 13:38
Python3 version of Unicode <=> KrutiDev converter
# KrutiDev to Unicode function
def KrutiDev_to_Unicode(krutidev_substring):
modified_substring = krutidev_substring
array_one = ["ñ","Q+Z","sas","aa",")Z","ZZ","‘","’","“","”",
"å", "ƒ", "„", "…", "†", "‡", "ˆ", "‰", "Š", "‹",
"¶+", "d+", "[+k","[+", "x+", "T+", "t+", "M+", "<+", "Q+", ";+", "j+", "u+",