Skip to content

Instantly share code, notes, and snippets.

View DanWahlin's full-sized avatar

Dan Wahlin DanWahlin

View GitHub Profile
@DanWahlin
DanWahlin / syncFolders.bash
Created June 27, 2023 20:30
Uses rsync to sync folders on a machine.
syncFolders() {
printf "%s" "Target Folder: "
read localFolder
printf "%s" "Destination Folder: "
read remoteFolder
printf "%s" "Excluded Folders (separated by space): "
read excludedFolders
array=($(echo "$excludedFolders" | tr ' ' '\n'))
# if [ -z "${excludedFolders[@]}" ]; then
git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -a
@DanWahlin
DanWahlin / classify_image.py
Last active May 3, 2018 20:19
Machine Learning Image Classifier Python Script
# Originally created by Lin JungHsuan: https://medium.com/@linjunghsuan/create-a-simple-image-classifier-using-tensorflow-a7061635984a
import tensorflow as tf, sys
image_path = sys.argv[1]
# Read in the image_data
image_data = tf.gfile.FastGFile(image_path, 'rb').read()
# Loads label file, strips off carriage return
label_lines = [line.rstrip() for line
@DanWahlin
DanWahlin / event-loop-test.js
Created February 24, 2017 20:18
Monitor Node Event Loop
//*********************************************************
// Quick and dirty way to detect event loop blocking
//*********************************************************
var lastLoop = Date.now();
function monitorEventLoop() {
var time = Date.now();
if (time - lastLoop > 1000) console.error('Event loop blocked ' + (time - lastLoop));
lastLoop = time;
setTimeout(monitorEventLoop, 200);
import { Injectable } from '@angular/core';
import { Subject, Subscription, Observable } from 'rxjs/Rx';
@Injectable()
export class EventBusService {
subject = new Subject<any>();
constructor() { }
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>GistRun</title>
<!--<link rel="stylesheet" href="styles.css">-->
</head>
<body>
<h1>Hello world!</h1>
<!--<script src="script.js"></script>-->
@DanWahlin
DanWahlin / index.html
Created October 25, 2015 18:14
Simple Angular App with Controller
<html ng-app="app">
<body>
<div ng-controller="CustomersController">
Name: <input type="text" ng-model="searchText" /> {{ searchText }}
<br />
<ul>
<li ng-repeat="person in people | filter:searchText | orderBy:'name' track by person.id">
{{ ::person.name }} - {{ ::person.city }}
</li>
@DanWahlin
DanWahlin / gist:ae61b8f75ec2efdece51
Last active August 29, 2015 14:18
Sample of my solvedIssues.md file that I add into every project
##Dust helpers not loading
Removed Dust.js functionality but leaving this in for future reference.
Inside the dustjs-helpers folder in your node_modules, you will notice dustjs-linkedin is version 2.3.5,
while in the node_modules folder of your app there is another version of dustjs-linkedin which is 2.4.0.
I deleted the older version and then everything works well.
https://github.com/krakenjs/kraken-js/issues/236
@DanWahlin
DanWahlin / gist:12021b5d88bace5bbd1c
Created May 5, 2014 09:40
Simple Node Server
var connect = require('connect');
connect.createServer(
connect.static(__dirname)
).listen(9000);
console.log('Listening on port 9000');
@DanWahlin
DanWahlin / animations.css
Created December 22, 2013 01:25
Sample AngularJS animations.
.slide-animation.ng-enter, .slide-animation.ng-leave {
-webkit-transition: 0.5s linear all;
-moz-transition: 0.5s linear all;
-o-transition: 0.5s linear all;
transition: 0.5s linear all;
position:relative;
height: 1000px;
}
.slide-animation.ng-enter {