Skip to content

Instantly share code, notes, and snippets.

View rms1000watt's full-sized avatar

Ryan M Smith rms1000watt

View GitHub Profile
@rms1000watt
rms1000watt / reactjs-dropzone-example.jsx
Last active June 22, 2016 18:33
ReactJS Dropzone Example
// http://stackoverflow.com/questions/4212861/what-is-a-correct-mime-type-for-docx-pptx-etc
// https://technet.microsoft.com/en-us/library/ee309278(office.12).aspx
import Dropzone from 'react-dropzone';
import Button from 'react-bootstrap/lib/Button';
const acceptedMimeTypes = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel";
...
@rms1000watt
rms1000watt / python-wireshark-hex-to-ascii.py
Created July 13, 2016 15:40
Python script to convert Wireshark Hex output to ASCII
def main():
packet = "|dc|ef|09|b0|e8|ba|ac|bc|32|91|f2|93|08|00|45|00|00|68|d8|73|40|00|40|06|4a|cd|c0|a8|01|07|95|38|c0|67|f5|62|0b|b9|3a|03|1d|1d|8f|c2|52|1d|80|18|10|15|64|61|00|00|01|01|08|0a|4e|2a|51|99|00|e4|c8|7e|03|00|00|34|2f|e0|00|00|00|00|00|43|6f|6f|6b|69|65|3a|20|6d|73|74|73|68|61|73|68|3d|67|6c|6f|77|63|6c|6f|75|64|5c|66|72|65|64|0d|0a|01|00|08|00|0b|00|00|00|"
packet = ''.join(packet.split('|'))
print packet.decode("hex")
if __name__ == '__main__':
main()
@rms1000watt
rms1000watt / python-tornado-server.py
Created July 15, 2016 17:15
Basic Python Tornado Server
import tornado.web
import tornado.escape
import tornado.ioloop
def main():
application = tornado.web.Application([
(r'/data', DataHandler),
(r'/ping', PingHandler)
])
@rms1000watt
rms1000watt / github-remove-ds_store.sh
Created July 17, 2016 16:08
Remove .DS_Store if you forgot to add it to your .gitignore initally
# http://stackoverflow.com/questions/107701/how-can-i-remove-ds-store-files-from-a-git-repository
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
@rms1000watt
rms1000watt / html-stimulsoft-frontend-nodejs.html
Created July 18, 2016 18:21
The missing HTML code for NodeJS backend connecting to SQL DB with Stimulsoft
<!-- The missing piece for: https://github.com/stimulsoft/Samples-JS/tree/master/Node.js/04.%20Start%20SQL%20Adapters%20from%20Http%20Server -->
<html>
<head>
<link href="stimulsoft.viewer.office2013.css" rel="stylesheet">
</head>
<body>
<h4>Hello World</h4>
<script src="stimulsoft.reports.js" type="text/javascript"></script>
@rms1000watt
rms1000watt / sql-lat-long-to-geography.sql
Created July 19, 2016 01:30
SQL Server Lat Long to Geography
-- http://www.sql-server-helper.com/sql-server-2008/convert-latitude-longitude-to-geography-point.aspx
UPDATE [Table1]
SET [GeoLocation] = geography::STPointFromText('POINT(' + CAST([Longitude] AS VARCHAR(20)) + ' ' + CAST([Latitude] AS VARCHAR(20)) + ')', 4326)
@rms1000watt
rms1000watt / bash-ffmpeg-speed-up-mp4.sh
Created July 21, 2016 14:55
FFMPEG from command line to speed up mp4 with installation steps
## If error installing ffmpeg = "yasm/nasm not found or too old"
## http://www.sthshare.com/wordpress/yasmnasm-not-found-or-too-old-on-linux-servercenots.html
# wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
# tar -xvf yasm-1.3.0.tar.gz
# cd yasm-1.3.0
# ./configure
# make
# make install
## http://superuser.com/questions/160443/software-to-speed-up-playback-of-mp4-files
@rms1000watt
rms1000watt / HTMLtoPDF.sh
Created July 21, 2016 18:45
Generate HTML Report then convert HTML Report to PDF
# cd to this directory
weasyprint index.html report.pdf
@rms1000watt
rms1000watt / python-generate-pdf-report.py
Created July 21, 2016 18:48
Python to generate PDF report
from fpdf import FPDF
PORTRAIT_FULL_WIDTH = 190
LANDSCAPE_FULL_WIDTH = 277
MAX_ROWS = 57
LEFT_MARGIN = 10.00125
pdf = None
def main():
global pdf
@rms1000watt
rms1000watt / python-backup-delete-copy.py
Created July 28, 2016 23:26
Python script to backup, delete, copy files from the home directory to a root directory (used on Ubuntu)
import os
import glob
import time
import shutil
def main():
appPath = '/etc/appName'
date = str(int(time.time()))
folders = glob.glob('staging/*')