Skip to content

Instantly share code, notes, and snippets.

View jcpst's full-sized avatar
💯

Joseph Post jcpst

💯
View GitHub Profile
@jcpst
jcpst / gist:06ed7465384c71c2aab4
Last active December 19, 2018 02:59
Live markdown preview using jquery and marked.js
// Live markdown preview w/ jquery and marked.js
// https://github.com/chjj/marked
// HTML:
//<textarea rows=5 id="input"></textarea>
//<div id="output"></div>
$(document).ready(function () {
$("#input").keyup(function () {
var text = $(this).val();
@jcpst
jcpst / git notes
Last active August 29, 2015 14:12
working with repos
create a branch
git checkout -b iss53
update a branch to master
$ git checkout jcpst
$ git merge master
@jcpst
jcpst / gist:97e8a5913060d4b45ecf
Last active August 29, 2015 14:12
up and running with express

redirect port 80 to 3000

sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3000

use forever

forever start --minUptime 1000 --spinSleepTime 1000 ./bin/www

@jcpst
jcpst / gist:bcdcc58142f5fd540162
Created January 5, 2015 03:38
Convert all mp3s in directory using LAME - BASH one-liner
for i in *.mp3; do lame --decode "$i"; done
@jcpst
jcpst / MonoDevelopFix
Last active August 29, 2015 14:12
MonoDevelop error launching web browser
When you have this error:
Error launching web browser
GLib.GException: There was an error launching the default action command associated with this location. at Gnome.Url.Show (System.String url) [0x00000] in :0 at MonoDevelop.Platform.GnomePlatform.ShowUrl (System.String url) [0x00000] in /build/src/monodevelop-2.8.5/src/addins/GnomePlatform/GnomePlatform.cs:134 at MonoDevelop.Ide.DesktopService.ShowUrl (System.String url) [0x00000] in /build/src/monodevelop-2.8.5/src/core/MonoDevelop.Ide/MonoDevelop.Ide/DesktopService.cs:84 at MonoDevelop.AspNet.Gui.BrowserLauncher.LaunchDefaultBrowser (System.String url) [0x00000] in /build/src/monodevelop-2.8.5/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.Gui/BrowserLauncher.cs:42
this command can help:
gconftool-2 --set --type=string /desktop/gnome/url-handlers/http/command '/usr/bin/firefox %s'
path to browser may need to be changed.
@jcpst
jcpst / gist:c1cc8e9161ef314462aa
Created January 30, 2015 17:24
Disable Dashboard in Spring Tools Suite 3.6.3

from here

Find the preference file

(workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.springsource.ide.eclipse.dashboard.ui.prefs)

And manually add (or change) the line:

org.springsource.ide.eclipse.dashboard.uidashboard.startup=false

@jcpst
jcpst / gist:5a5cd9db92fdb4354fcb
Last active August 29, 2015 14:14
download entire website
@jcpst
jcpst / gist:69f4e2e8729e24aaa944
Created February 17, 2015 16:07
bad local commit

from here

Whoops, didn't want to commit that...

Leave tracked files untouched (use --hard to remove all tracked changes):

git reset --soft HEAD~1

If you already pushed, add a new commit that reverts the last commit:

@jcpst
jcpst / gist:23143f55ee6faebd1cd3
Last active August 29, 2015 14:16
find git repos in home directory
# from here: http://sixarm.com/about/git-how-to-find-git-repository-directories.html
find ~ -type d -name .git | xargs -n 1 dirname
#from here: http://stackoverflow.com/questions/24710521/calculating-average-value-of-temp-from-lm-sensors-using-bash-script
sensors | awk '/^Core /{++r; gsub(/[^[:digit:]]+/, "", $3); s+=$3} END{print s/(10*r) "°C"}'