Skip to content

Instantly share code, notes, and snippets.

View rhaps0dy's full-sized avatar
💭
solving AI alignment

Adrià Garriga-Alonso rhaps0dy

💭
solving AI alignment
View GitHub Profile
@rhaps0dy
rhaps0dy / cartpole.xml
Created December 23, 2017 08:13
Bullet CartPole simulation files
<mujoco model="inverted pendulum">
<compiler inertiafromgeom="true"/>
<default>
<joint pos="0 0 0" armature="0" damping="0" frictionloss="0" limited="true"/>
<geom pos="0 0 0" contype="0" conaffinity="0" friction="0 0 0"
rgba="0.7 0.7 0 1"/>
<tendon/>
<motor ctrlrange="-1 1" ctrllimited="true"/>
</default>
<option gravity="0 0 -9.81" integrator="RK4" timestep="0.02"/>
@rhaps0dy
rhaps0dy / a.txt
Created February 2, 2018 12:45
Images for Spacemacs issue
fdsf
@rhaps0dy
rhaps0dy / natural_variational_distribution.py
Created July 9, 2020 20:12
Natural variational distribution + tests
#!/usr/bin/env python3
import abc
import torch
from gpytorch.distributions import MultivariateNormal
from gpytorch.lazy import CholLazyTensor
from gpytorch.variational._variational_distribution import \
_VariationalDistribution
@rhaps0dy
rhaps0dy / latexsub.el
Created October 12, 2020 14:58
LaTeX -> unicode substitution as used in Julia
;;; packages.el --- latexsub layer packages file for Spacemacs.
;;
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
;;
;; Author: Adrià Garriga Alonso <adria@k9>
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
import math
import numpy as np
def logsumexp(a, b):
"""Stable log(exp(a) + exp(b))"""
m = np.maximum(a, b)
return m + np.log(np.exp(a - m) + np.exp(b - m))
@rhaps0dy
rhaps0dy / analyze.py
Created November 11, 2025 06:44
Analyze CVE data
import json
from pathlib import Path
cves_dir = Path('cves/2025')
severity_count = {'CRITICAL': 0, 'HIGH': 0, 'MEDIUM': 0, 'LOW': 0, 'UNKNOWN': 0}
total = 0
for json_file in cves_dir.rglob('*.json'):
total += 1
try: