Skip to content

Instantly share code, notes, and snippets.

@edwios
edwios / particle-photon-aes-encryption-demo.ino
Last active November 12, 2016 20:06 — forked from towynlin/spark-aes-encryption-demo.ino
Demo Particle (formerly Spark) Photon firmware using AES-128-CBC
#include "application.h"
#include "spark_protocol.h"
#include "tropicssl/rsa.h"
#include "tropicssl/aes.h"
void sixteenRandomBytes(unsigned char buf[16]) {
for (int i = 0; i < 16; i++) {
buf[i] = rand() & 0xff;
}
}
@edwios
edwios / osx-mongodb-rlimits-fix.md
Created July 1, 2017 06:10 — forked from tamitutor/osx-mongodb-rlimits-fix.md
Fix Mongodb "soft rlimits" Warning On Mac OS X (Yosemite)

If you are seeing Mongo soft rlimits warnings in your logs, or a WARNING: soft rlimits too low. Number of files is 256, should be at least 1000 when you login to mongo shell via mongo from the commandline, or any mysterious/unexplained mongo connection errors... follow this how-to exactly and it will resolve the issue for you.

(Source of this how to found at basho/basho_docs#1402)

First file: sudo vi /Library/LaunchDaemons/limit.maxfiles.plist

...containing:

@edwios
edwios / install_caffe_osx.sh
Last active September 14, 2017 17:04 — forked from soobrosa/install_caffe_osx.sh
Caffe install + benchmark script for OSX
# tested on Macbook Air 13", early 2015, 1,6 Ghz Intel Core i5, 8Gb RAM running macOS Sierra
# tested on MacBook Pro 13" Touchbar, 2016, 3.3 GHz Intel Core i7, 16GB RAM running macOS Sierra 10.12.6
# if you don't have brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update
# dependencies
brew install -vd snappy leveldb gflags glog szip lmdb
brew tap homebrew/science
@edwios
edwios / install_caffe_rpi.sh
Last active September 26, 2017 14:02 — forked from soobrosa/install_caffe_rpi.sh
Caffe install + benchmark script for Raspbian Jessie
# tested on a Raspbery Pi 3 running a Raspbian Jessie July 2017
# Install OpenCV 3.3
# See: https://gist.github.com/edwios/5410ceabca579bed7ff1d1b62ee395a1
# dependencies
apt-get update
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev protobuf-compiler
sudo apt-get install --no-install-recommends libboost-all-dev
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
@edwios
edwios / install_opencv_rpi.sh
Last active September 26, 2017 14:01 — forked from soobrosa/install_opencv_rpi.sh
Install OpenCV on a Raspbian Jessie
# thanks to
# https://medium.com/r/?url=https%3A%2F%2Fncsforum.movidius.com%2Fdiscussion%2Fcomment%2F299%2F%23Comment%5C_299
# https://ahmedibrahimvt.wordpress.com/2017/02/19/fatal-error-hdf5-h-no-such-file-or-directory/
# http://www.pyimagesearch.com/2015/07/20/install-opencv-3-0-and-python-3-4-on-ubuntu/
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential cmake pkg-config
sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
@edwios
edwios / Server.py
Last active June 25, 2021 09:56 — forked from kristoferjoseph/Server.py
A simper python http server can handle mime type properly
# -*- coding: utf-8 -*-
#test on python 3.4 ,python of lower version has different module organization.
import http.server
from http.server import HTTPServer, BaseHTTPRequestHandler
import socketserver
PORT = 8080
Handler = http.server.SimpleHTTPRequestHandler
@edwios
edwios / Events & Delegates in Unity C#
Created March 13, 2023 07:54 — forked from dylanfries/Events & Delegates in Unity C#
Events and Delegates for Unity (C#)
Events & Delegates
------------------
Events and Delegates were something I struggled with when I was first learning how they worked. Once I figured it out it became one of the most useful and powerful techniques for games. Its especially useful for helping to decouple classes while allowing for messaging.
Delegates - Simply a container for a function that can be used as a variable.
Events - Allows you to specify a delegate that gets called when some event in your code is triggered.
Overview