Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define MAX_FIB 51
unsigned long int fib[MAX_FIB];
void genfib(int maxf){
int i;
IsNotFibo
IsNotFibo
IsNotFibo
IsNotFibo
IsNotFibo
IsNotFibo
IsNotFibo
IsNotFibo
IsNotFibo
IsNotFibo
/*
* Copyright (c) 2000 The Regents of the University of California.
*
* See the file "LICENSE" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include <linux/kernel.h>
#include <linux/module.h>
@kenprice
kenprice / schema.xml
Created November 12, 2015 03:50
Ken's schema.xml
<?xml version="1.0" encoding="UTF-8" ?>
<schema name="gios-stuff" version="0.1">
<fields>
<!-- Should id be string? -->
<field name="id" type="string" indexed="true" stored="true" required="true"/>
<field name="title" type="textgen" indexed="true" stored="true"/>
@kenprice
kenprice / guess_seeds.py
Last active June 26, 2022 15:41
cryptogreetings r/Bitcoin puzzle - BIP49 seed word guessing util
from electrum import util, keystore, bitcoin
import argparse
import sys
import threading
MAX_THREADS=25
TARGET_ADDR="3CcxyPhyvyc3S9UuPfu42GNZLvVVV11Uk8"
# How many of the address indexes to try. Default to just /0.
# i.e. last digit in derivation path: m/49'/0'/0'/0/0
MAX_ADDR_IDX=1
@kenprice
kenprice / fitnotes_graph.py
Last active January 1, 2019 09:13
fitnotes-graph
# Given FitNotes CSV export, plot estimated 1RM
#
# Usage: fitnotes_graph.py <FILE>
# <FILE> is exported csv
# Assumes format:
# ['Date', 'Exercise', 'Category', 'Weight (lbs)', 'Reps', 'Distance',
# 'Distance Unit', 'Time', 'Comment']
import csv
from datetime import datetime
from dateutil.relativedelta import relativedelta
@kenprice
kenprice / palindrome.hs
Created January 1, 2019 23:17
Project Euler Problem 4
import Data.List
products :: [Int]
products = reverse (Data.List.sort [x*y | x<-[100..999], y<-[100..999]])
isPalindrome :: Int -> Bool
isPalindrome x = (read (reverse (show x)) :: Int) == x
getLargestPalindrome :: [Int] -> Int
getLargestPalindrome xs =
@kenprice
kenprice / latticepaths.hs
Created January 1, 2019 23:23
Project Euler Problem 15
pascal :: Int -> [Int]
pascal k = iterate pascal' [] !! k
pascal' :: [Int] -> [Int]
pascal' [] = [1]
pascal' xs = [1] ++ zipWith (+) xs (tail xs) ++ [1]
getNumLatticePathsForGrid :: Int -> Int
getNumLatticePathsForGrid n = pascal (n * 2 + 1) !! n
@kenprice
kenprice / numbers-spiral-diagonals.hs
Created January 1, 2019 23:26
Project Euler Problem 28
sumDiag :: Int -> Int
sumDiag 0 = 1
sumDiag x =
sumDiag (x-1) + (4 * x') - (12 * x)
where x' = ((x * 2) + 1) ^ 2
main :: IO()
main = putStrLn (show (sumDiag 500))
@kenprice
kenprice / counting-hexagons.hs
Created January 1, 2019 23:57
Euler Project Problem 577
triangularNumbers = [ quot (x^2 + x) 2 | x <- [1..12345] ]
hexSums' :: Int -> [Int] -> [Int]
hexSums' n sumList =
if allZeroes sumList then
sumList
else
zipWith (+) sumList nextList
where
nextList = hexSums' (n+1) (take 12345 nextTriNums)