Skip to content

Instantly share code, notes, and snippets.

View sajith's full-sized avatar
😼
Why would I want to set a status on GitHub?

Sajith Sasidharan sajith

😼
Why would I want to set a status on GitHub?
View GitHub Profile
@sajith
sajith / threads.py
Last active April 18, 2023 13:59
What happens when main thread of a Python process crashes?
# Adapted from https://realpython.com/intro-to-python-threading/
import logging
import threading
import time
def thread_function():
logging.info("Starting")
@sajith
sajith / pickle-poke.py
Last active June 30, 2021 13:54
What's in Mailman's pickles?
#! /usr/bin/env python2.7
"""
A script to export pickle-ed (*.pck*) files into a corresponding
human-readable form. This was specifically written to read such
files created by Mailman 2, so this is all Python 2.7
I was given copies of /var/lib/mailman and /etc/mailman. In order
to go through the files under them, I used Docker (we need old
Mailman libraries to unpickle some of those files, and that is a
@sajith
sajith / gist:bb1ed5d1b14ae10236c7ba9344a0af6d
Created August 19, 2020 11:02
cabal install hakyll error
$ cabal install hakyll --installdir=/tmp/hakyll/
Resolving dependencies...
Build profile: -w ghc-8.10.1 -O1
In order, the following will be built (use -v for more details):
- hakyll-2.1.1 (lib:hakyll) (requires build)
Starting hakyll-2.1.1 (all, legacy fallback)
Building hakyll-2.1.1 (all, legacy fallback)
Failed to build hakyll-2.1.1.
Build log ( /Users/sajith/.cabal/logs/ghc-8.10.1/hkyll-2.1.1-eb5374c9.log ):
@sajith
sajith / gist:497f78218613ea5afc0d9e41b4b254fe
Last active May 7, 2021 12:42
cabal install hakyll-4.13.4.0
$ cabal install hakyll-4.13.4.0 --installdir=/tmp/hakyll/
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: hakyll-4.13.4.0 (user goal)
[__1] trying: hakyll:+usepandoc
[__2] next goal: pandoc (dependency of hakyll +usepandoc)
[__2] rejecting: pandoc-2.10.1, pandoc-2.10 (conflict: hakyll +usepandoc =>
pandoc>=2.0.5 && <2.10)
[__2] trying: pandoc-2.9.2.1
[__3] next goal: haddock-library (dependency of pandoc)
coverage run-test: commands[1] | magic-folder --version
Magic Folder version 0.0.0.post761
coverage run-test: commands[2] | coverage run --branch -m twisted.trial --rterrors magic_folder.test.test_status.StatusTests.test_status
Loading Hypothesis profile default
magic_folder.test.test_status
StatusTests
test_status ... Traceback (most recent call last):
File "/Users/sajith/projects/tahoe/magic-folder/.tox/coverage/lib/python2.7/site-packages/twisted/trial/runner.py", line 625, in loadByNames
things.append(self.findByName(name))
File "/Users/sajith/projects/tahoe/magic-folder/.tox/coverage/lib/python2.7/site-packages/twisted/trial/runner.py", line 429, in findByName
curl 'http://localhost:3456/uri/URI%3ADIR2%3Ajlq24ke74q6nw7uovxkdxqndmq%3Aizlhsgj6impvjodnux4pszabuqvcyvbuanzcjo6mpdops3nvup2a/' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:76.0) Gecko/20100101 Firefox/76.0' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Content-Type: multipart/form-data; boundary=---------------------------95562798711815948203696896838' -H 'Origin: null' -H 'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1' -H 'DNT: 1' --data-binary $'-----------------------------95562798711815948203696896838\r\nContent-Disposition: form-data; name="t"\r\n\r\nmkdir\r\n-----------------------------95562798711815948203696896838\r\nContent-Disposition: form-data; name="when_done"\r\n\r\n.\r\n-----------------------------95562798711815948203696896838\r\nContent-Disposition: form-data; name="name"\r\n\r\ntest\r\n-----------------------------95562798711815948203696896838\r\nContent-Disposition: form-data;
@sajith
sajith / gist:007d8ceb0a3e771bf3e8f1beb8f30d44
Created April 21, 2020 16:55
After "git merge --no-ff sajith-3254.01-status-nevow-to-twisted-web"
* commit bd8bf0f91c1d608858b80858de0ac996c8ce838b
|\ Merge: 34e85ac51 225bb5854
| | Author: Sajith Sasidharan <sajith@hcoop.net>
| | Date: Tue Apr 21 12:49:42 2020 -0400
| |
| | Merge branch 'sajith-3254.01-status-nevow-to-twisted-web'
| |
| * commit 225bb5854a93e0ba8244346cda79b289c2f7d937
| | Author: Sajith Sasidharan <sajith@hcoop.net>
| | Date: Tue Mar 24 17:36:15 2020 -0400
@sajith
sajith / gist:e3ebd9ec2a0301a8a81633ba3a4c3467
Created April 21, 2020 16:27
git log --oneline --graph --decorate origin/master..HEAD
* 225bb5854 (HEAD -> 3254.01-status-nevow-to-twisted-web, mine/3254.01-status-nevow-to-twisted-web) Add empty news fragment re. Statistics page rendering
* d844a8f89 Use twisted transparent tag to render data
* a0eb00b2c Wrap renderer return values in tags
* 1e3ba25cc Add some documentation to Statistics page
* 652b3f5bc Use twisted.web.template to render Statistics page
@sajith
sajith / gist:990a64fa10eb320633708c9ec4d16f02
Created April 21, 2020 16:12
"git log --graph -n 10"
* commit 225bb5854a93e0ba8244346cda79b289c2f7d937
| Author: Sajith Sasidharan <sajith@hcoop.net>
| Date: Tue Mar 24 17:36:15 2020 -0400
|
| Add empty news fragment re. Statistics page rendering
|
* commit d844a8f89f50df391a8a6e217c0bc76f8e149cd5
| Author: Sajith Sasidharan <sajith@hcoop.net>
| Date: Thu Apr 16 17:29:54 2020 -0400
|
@sajith
sajith / test_bit_set.cpp
Created October 7, 2019 02:01
Check if a bit is set
#include <iostream>
bool test_bit_set(unsigned num, unsigned idx)
{
return (num & (1 << idx)) != 0;
}
int main()
{
for (unsigned n = 0; n < 8; n++)