Skip to content

Instantly share code, notes, and snippets.

View mrcampbell's full-sized avatar

Mike Campbell mrcampbell

  • Divvy
  • Northern Utah
View GitHub Profile
@mrcampbell
mrcampbell / frequency_estimator.py
Last active July 9, 2024 10:00 — forked from endolith/frequency_estimator.py
Frequency estimation methods in Python
from __future__ import division
from scikits.audiolab import flacread
from numpy.fft import rfft, irfft
from numpy import argmax, sqrt, mean, diff, log
from matplotlib.mlab import find
from scipy.signal import blackmanharris, fftconvolve
from time import time
import sys
from parabolic import parabolic
<article class="speakerslist">
<div class="container">
<div class="row">
<div class="col-sm-8">
<h3 class="speakerslist-title">title</h3>
<h5 class="speakerslist-name">with <a href="/speakers/shortname">name</a></h5>
<p class="speakerslist-info"><a href="/speakers/shortname">
<img class="speakerslist-img img-circle pull-left" src="/images/speakers/shortname_tn.jpg" alt="Photo of name"></a>
summary
</a></p>
@mrcampbell
mrcampbell / NullValueLogicWithCondition.js
Created September 2, 2016 16:02
Similar to SQL's NVL function, but with an optional condition to
// null value logic - condition provided
function nvlc(input, alternative, condition=null) {
"use strict";
if (condition != null) {
if (condition(input)) {
return input;
} else {
return alternative;
}
} else {
class Chain():
def __init__(self):
self.exampleString = ''
def prepend(self, str):
self.exampleString = str + self.exampleString;
return self
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
##### NOTE #####
# THIS MAY NOT BE THE BEST OPTION. I Would also look up subqueries. https://www.techonthenet.com/oracle/subqueries.php
# But this is an example of dynamically creating and executing queries with Python. So, this is a Cadillac solution to a
# Bicycle problem, but something that I think you should be aware of. It can simplify life SO MUCH more than PL/SQL, but
# as I was writing this, you might have better luck with a subquery.. oh well!
import sqlite3
# Python DOES NOT have constants. These are global variables, so don't copy this in super huge projects.
@mrcampbell
mrcampbell / AndroidToolbox-Realm.java
Created March 7, 2017 00:09
Basic Implementation of Realm for Android
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import io.realm.Realm;
import io.realm.RealmResults;
public class MainActivity extends AppCompatActivity {
// Class specific variables and constants
@mrcampbell
mrcampbell / Element.Java
Created March 8, 2017 23:33
Pokemon Game MoveBase Switch Statement
public enum Element {
NORMAL,
FIRE,
WATER,
ELECTRIC,
GRASS,
ICE,
FIGHTING,
POISON,
GROUND,
@mrcampbell
mrcampbell / index.html
Created May 8, 2017 18:53
Basic demonstration of an Async REST call for a friend.
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
@mrcampbell
mrcampbell / Book.cs
Created May 22, 2017 04:39
Demonstration of C# Object Inheritance
using System;
// The sealed keyword enables you to prevent the inheritance of a class or certain class members
// that were previously marked virtual.
public sealed class Book : Publication
{
/*
The first constructor uses the this keyword to call the other constructor.
This is a common pattern in defining constructors; constructors with fewer parameters