Skip to content

Instantly share code, notes, and snippets.

@jmoy
jmoy / anderson.md
Created November 30, 2024 06:14
ChatGPT genereated review of "In the Tracks of Historical Materialism"

Tracing the Threads of Marxism: A Reflection on Perry Anderson's "In the Tracks of Historical Materialism"

I recently picked up Perry Anderson's In the Tracks of Historical Materialism, a seminal work that had been lingering on my reading list for far too long. Delving into its pages, I was struck by the depth of Anderson's analysis of Western Marxist thought from the aftermath of World War II up to the mid-1970s. His exploration offers not just a historical account but also a critical examination of the enduring tensions within Marxist theory—tensions that continue to resonate in contemporary social science.

Anderson meticulously charts the trajectory of leftist intellectual movements across Europe, situating key figures like Jean-Paul Sartre, Louis Althusser, Jürgen Habermas, and Michel Foucault within their specific political and social contexts. He examines how these thinkers grappled with the challenges of their times—reconstruction after the war, the rise of consumer capitalism, the crises of th

@jmoy
jmoy / maternal.do
Created February 16, 2024 06:32
Calculate maternal health deprivation headcount from NFHS5 data
clear all
frame create maternal_depr
frame maternal_depr {
use "IABR7EFL.DTA"
keep if midx==1
gen no_trained_assist = (m3a==0 & m3b==0 & m3c==0)
gen few_antenatal = m14<4
gen missed = missing(m14) | missing(m3a) | missing(m3b) | missing(m3c) | m14>=98
collapse (max) no_trained_assist few_antenatal missed, by(v001 v002)
gen deprived = no_trained_assist|few_antenatal
@jmoy
jmoy / Makefile
Last active November 16, 2021 05:42
memlimited: memlimited.cc calc_mean.cc calc_mean.h
clang++ -o memlimited -O3 --std=c++17 \
-ffast-math -march=native \
memlimited.cc calc_mean.cc -pthread
@jmoy
jmoy / Makefile
Last active November 16, 2021 03:38
A memory bandwidth limited computation
memlimited: memlimited.cc calc_mean.cc calc_mean.h
g++ -o memlimited -O3 -march=native -fopenmp memlimited.cc calc_mean.cc
@jmoy
jmoy / analyze.cc
Last active October 23, 2021 09:32
Grouped weighted mean
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <unordered_map>
#include <utility>
using namespace std;
#include <time.h>
#include <sys/time.h>
#include <sys/resource.h>
@jmoy
jmoy / three-count.py
Created June 6, 2019 07:27
Three Counters
counters = {key:collections.Counter() for key in ['child','mother','father']}
with open("day2/names.csv") as f:
rdr = csv.DictReader(f)
for r in rdr:
for key in counters:
l = r[key].split()
if len(l)>0:
counters[key][l[0]] += 1
commonize = lambda ctr,N: {t[0] for t in ctr.most_common(N)}
@jmoy
jmoy / degrees.py
Created June 6, 2019 06:06
Session 1 in Python
with open("code/test2.txt") as fin:
sbj_counts = {}
for l in fin:
l = l.strip()
m = re.fullmatch(r"((?:\w|\.)+)\s+in\s+(\w+)",l)
if m:
degree,subject = m.group(1,2)
print(f"{degree} ({subject})")
if subject in sbj_counts:
sbj_counts[subject].add(degree)
@jmoy
jmoy / Friends2.thy
Last active January 29, 2019 02:51
Solving a puzzle using Isabelle: 2nd attempt
section ‹A Simple Graph Problem: Second Attempt›
text ‹
We shall prove the following: "In a finite group of people, some of whom are friends with some
of the others there must be at least two people who have the same number of friends."
theory Friends
imports Main
Finite_Set
@jmoy
jmoy / Friends.thy
Last active June 10, 2022 20:56
Solving a puzzle using the Isabelle proof assistant
section ‹A Simple Graph Problem›
text ‹
We shall prove the following: "In a finite group of people, some of whom are friends with some
of the others there must be at least two people who have the same number of friends."
theory Friends
imports Main
Finite_Set
@jmoy
jmoy / thin-film.ipynb
Last active November 18, 2018 19:51
Why soap bubbles are colorful and windowpanes are not
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.