Skip to content

Instantly share code, notes, and snippets.

View blog1729's full-sized avatar

Anon blog1729

  • No, his mind is not for rent to any God or government
  • In front of a computer
View GitHub Profile
@blog1729
blog1729 / Debug-init
Created October 24, 2015 13:48
Emacs Error
Debugger entered--Lisp error: (file-error "https://melpa.org/packages/archive-contents" "Not implemented")
signal(file-error ("https://melpa.org/packages/archive-contents" "Not implemented"))
url-insert-file-contents("https://melpa.org/packages/archive-contents")
package--download-one-archive(("melpa" . "https://melpa.org/packages/") "archive-contents")
#[0 "\301\300\302\"\207" [("melpa" . "https://melpa.org/packages/") package--download-one-archive "archive-contents"] 3 "\n\n(fn)"]()
funcall(#[0 "\301\300\302\"\207" [("melpa" . "https://melpa.org/packages/") package--download-one-archive "archive-contents"] 3 "\n\n(fn)"])
package-refresh-contents()
(progn (package-refresh-contents) (require-package package min-version t))
(if (or (assoc package package-archive-contents) no-refresh) (package-install package) (progn (package-refresh-contents) (require-package package min-version t)))
(if (package-installed-p package min-version) t (if (or (assoc package package-archive-contents) no-refresh)
@blog1729
blog1729 / .gitignore
Created May 9, 2015 07:10
Git ignore for Haskell
# Ignore everything
*
# But not these files
!.gitignore
!*.hs
# Even if they are in subdirectories
!*/
@blog1729
blog1729 / .gitignore
Created April 22, 2015 10:41 — forked from kogakure/.gitignore
gitignore for LaTeX
*.aux
*.glo
*.idx
*.log
*.toc
*.ist
*.acn
*.acr
*.alg
*.bbl
@blog1729
blog1729 / gbm.R
Created April 19, 2015 08:27
Geometric Brownian motion
sigma = 0.3
mu = 0.06
N = 1000
flag = 0
lambda = c(0.01, 0.05, 0.1, 0.5, 1)
xs = c(5)
Xs = matrix(5, nrow = 5, ncol = N)
zs = rnorm(N)
for (i in 2:N)
{
@blog1729
blog1729 / cleanWiki.js
Last active August 29, 2015 14:19
Greasemonkey script for clean Wikipedia
// ==UserScript==
// @name Clean Wikipedia
// @namespace en.wikipedia.org/wiki/*
// @include about:newtab
// @version 1
// @grant none
// @run-at document-start
// ==/UserScript==
current = window.location.pathname.toString();
@blog1729
blog1729 / separate
Created March 4, 2015 15:21
Separating Y into Y_l and Y_r: Finding closest pair of 2-D points
let Y_l[1 ... Y.length] and Y_r[1 ... Y.length] be new arrays
Y_l.length = 0
Y_r.length = 0
for i = 1 to Y.length
if Y[i] belongs to P_r
Y_l.length++
Y_l[Y_l.length] = Y[i]
else
Y_r.length++
Y_r[Y_r.length] = Y[i]
@blog1729
blog1729 / sum.s
Created February 21, 2015 13:31
Program to find the sum of first n positive integers using a loop where n is taken as input
# Program to find the sum of first n natural numbers, where the user will input n, the program uses a loop even though there is a closed form answer. #
.data
cmd_prompt:
.asciiz "Enter a positive integer: "
ans_cmd:
.asciiz "The answer is: "
.text
main:
#Prompt
li $v0, 4
@blog1729
blog1729 / name.s
Created February 21, 2015 11:34
MIPS assembly instructions to ask for name and print it using SPIM assembler
#Program that will ask the name of the user and later print Hello, followed by name #
.data
name_prompt:
.asciiz "Enter your name "
salute:
.asciiz "Hello, "
name:
.space 20
.text
@blog1729
blog1729 / acceptance-rejection
Created February 18, 2015 16:50
Algorithm for acceptance rejection
generate X from distribution g
generate U from Unif[0,1]
if U <= f(X)/cg(X)
return X
otherwise
go to Step 1
@blog1729
blog1729 / marsaglia-bray
Last active September 18, 2021 13:56
Algorithm for Marsaglia Bray
while(X>1)
generate U1, U2 in Unif[0,1]
U1 <- 2*U1 - 1
U2 <- 2*U2 - 1
X <- U1^2 + U2^2
end
Y <- sqrt(-2log X /X)
Z1 <- U1Y
Z2 <- U2Y
return Z1, Z2