This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pathlib import Path | |
import numpy as np | |
import pandas as pd | |
from empirical.util import openquake_wrapper_vectorized as openquake | |
from empirical.util import z_model_calculations | |
from empirical.util.classdef import GMM, TectType | |
from matplotlib import pyplot as plt | |
import numexpr as ne | |
from qcore import coordinates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun treesit-mark-bigger-node () | |
(interactive) | |
(let* ((node (treesit-node-on (region-beginning) (region-end)))) | |
(let ((next-node (treesit-parent-until node (lambda (n) | |
(not (and | |
(= (region-beginning) (treesit-node-start n)) | |
(= (region-end) (treesit-node-end n)))))))) | |
(set-mark (treesit-node-end next-node)) | |
(goto-char (treesit-node-start next-node))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Invoke via M-x doc-view-transient | |
(transient-define-prefix doc-view-transient () | |
"Transient for doc-view mode." | |
[:class transient-columns ;; the class sets how the transient is displayed; we have each category as a column. | |
["Zoom" | |
("+" "Enlarge" doc-view-enlarge :transient t) ;; :transient commands keep the transient prompt open | |
("-" "Shrink" doc-view-shrink :transient t) | |
("w" "Fit window to page" doc-view-fit-window-to-page :transient t) | |
("W" "Fit width to window" doc-view-fit-width-to-window :transient t)] | |
["Navigation" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; -*- mode: Lisp -*- | |
#-quicklisp | |
(let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp" | |
(user-homedir-pathname)))) | |
(when (probe-file quicklisp-init) | |
(load quicklisp-init))) | |
(in-package :stumpwm) | |
(require 'swank) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LoadPackage("fining"); | |
e := 3; | |
q := 2 ^ e; | |
aut := 2^((e + 1) / 2); | |
pg := PG(2, q^2); | |
F := GF(q); | |
Ex := GF(q^2); | |
w := Z(q^2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import Counter | |
import tensorflow as tf | |
import tensorflow.keras as keras | |
import tensorflow.keras.layers as layers | |
from nltk import word_tokenize | |
class BengioModel(keras.Model): | |
''' Model that replicates the architecture of Bengio et al. ''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Lib | |
where | |
import Graphics.Gloss | |
density :: Float | |
density = 0.1 | |
spiral :: [Float] -> [(Float, Float)] | |
spiral pts = map f pts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from enum import Enum, auto | |
class HeadMove(Enum): | |
LEFT = -1 | |
RIGHT = 1 | |
NOTHING = 0 | |
class TuringMachine: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program := 0; | |
i := 0; | |
read program; | |
read i; | |
j := i; | |
l := 0; | |
data := 0; | |
while j >= 0 do | |
pow := 1; | |
k := 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
def sort_of(numbers): | |
""" Old bad code. | |
Computes the minimum element of each sublist from i..n where n is the length of the list. """ | |
result = [] | |
for i in range(len(numbers)): | |
sub = sorted(numbers[i:]) |
NewerOlder