Skip to content

Instantly share code, notes, and snippets.

View dkreider's full-sized avatar
🤠
Breaking my keyboard...

Daniel Kreider dkreider

🤠
Breaking my keyboard...
View GitHub Profile
@dkreider
dkreider / single-linear-regression.py
Last active November 7, 2017 19:36
Very basic single linear regression example in Python
# Very basic single linear regression example in Python. Daniel Kreider Oct. 28 2017
#
#
# X(input)
# 9 |
# 8 | *
# 7 | *
# 6 | *
# 5 | *
# 4 | *
@dkreider
dkreider / nb-classifier.py
Last active March 5, 2018 13:30
Beginners guide to building a Naive Bayes classifier (https://danielk.tech/blog/build-your-first-naive-bayes-classifier.html)
from sklearn import cross_validation
from sklearn.naive_bayes import GaussianNB
from sklearn.feature_selection import SelectPercentile, f_classif
from sklearn.feature_extraction.text import TfidfVectorizer
words = ["I am strong", "I am slender", "I am handsome", "I am pretty", "I am big", "I am beautiful", "strength", "pretty", "muscle", "looks"]
authors = ["man", "woman", "man", "woman", "man", "woman", "man", "woman", "man", "woman"]
word_test = ['beauty', 'big muscle']
# Split into training and testing data.
@dkreider
dkreider / mongo_backup.sh
Last active June 3, 2019 12:34 — forked from sheharyarn/mongo_backup.sh
Mongodump Shell Script for Cronjob
#!/bin/bash
MONGO_DATABASE="your_db_name"
MONGO_HOST="127.0.0.1"
MONGO_PORT="27017"
TIMESTAMP=`date +%F`
MONGODUMP_PATH="/usr/bin/mongodump"
BACKUPS_DIR="/home/username/backups/$APP_NAME"
BACKUP_NAME="$TIMESTAMP"
# -*- coding: utf-8 -*-
"""Stock Prediction.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1Q2USewP4-0keoFCGLggC3-QCQf95vGQH
"""
!kaggle datasets download -d rpaguirre/tesla-stock-price
@dkreider
dkreider / older_than_10_days.sh
Created June 19, 2019 12:20
Delete files and folders older than 10 days old
find * -mtime +12 -exec rm -rf {} \;
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { MatToolbarModule } from '@angular/material/toolbar';
import { AppComponent } from './app.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
@NgModule({
declarations: [
<mat-toolbar>
<span>Hello World</span>
</mat-toolbar>
@dkreider
dkreider / add-ca-cert.js
Created July 5, 2019 14:41 — forked from mozfreddyb/add-ca-cert.js
privileged JS for Firefox to add a certificate as a trusted CA
if (typeof Cc == "undefined") { Cc = Components.classes; }
if (typeof Cu == "undefined") { Cu = Components.utils; }
if (typeof Ci == "undefined") { Ci = Components.interfaces; }
const nsX509CertDB = "@mozilla.org/security/x509certdb;1";
const nsIX509Cert = Ci.nsIX509Cert;
const nsIX509CertDB = Ci.nsIX509CertDB;
const certdb = Cc[nsX509CertDB].getService(nsIX509CertDB);
let certstring = `-----BEGIN CERTIFICATE-----
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>HelloWorld</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css">
</head>
@dkreider
dkreider / part-angular.json
Created July 12, 2019 15:27
Add support for Semantic UI buttons
"styles": [
"src/styles.css",
"node_modules/semantic-ui-css/components/button.min.css"
],