Skip to content

Instantly share code, notes, and snippets.

Joshua Bakita JoshuaJB

Block or report user

Report or block JoshuaJB

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@JoshuaJB
JoshuaJB / main.c
Created Jun 3, 2015
Pebble Accelerometer Variance Demo Scaffold
View main.c
#include <pebble.h>
Window *my_window;
TextLayer *text_layer;
// isqrt_impl and isqrt provided by Siu Ching Pong on stackoverflow
uint32_t isqrt_impl(uint64_t const n, uint64_t const xk) {
uint64_t const xk1 = (xk + n / xk) / 2;
return (xk1 >= xk) ? xk : isqrt_impl(n, xk1);
}
@JoshuaJB
JoshuaJB / main.c
Created Jun 3, 2015
Pebble Accelerometer Average Demo Scaffold
View main.c
#include <pebble.h>
// NOTE: See http://developer.getpebble.com/docs/c/Foundation/Event_Service/AccelerometerService/ for docs
Window *my_window;
TextLayer *text_layer;
static void display_acceleration(AccelData * data, uint32_t num_samples);
// TODO: Write accelerometer event handler
// TODO: All all the data points together for each axis, then divide by the number of samples
@JoshuaJB
JoshuaJB / app.js
Last active Aug 29, 2017
Basic Pebble App with WebSockets
View app.js
/**
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*/
var UI = require('ui');
@JoshuaJB
JoshuaJB / patch
Created Dec 26, 2013
Patch to enable profiling using yappi on the WFG 0 A.D. lobby bot.
View patch
Index: source/tools/XpartaMuPP/XpartaMuPP.py
===================================================================
--- source/tools/XpartaMuPP/XpartaMuPP.py (revision 14390)
+++ source/tools/XpartaMuPP/XpartaMuPP.py (working copy)
@@ -16,7 +16,7 @@
* You should have received a copy of the GNU General Public License
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
"""
-
+import yappi
@JoshuaJB
JoshuaJB / options.xml
Created Sep 18, 2013
Options menu for 0AD.
View options.xml
<?xml version="1.0" encoding="utf-8"?>
<!--
==========================================
- Options Window -
==========================================
-->
<objects>
<script file="gui/common/functions_civinfo.js"/>
View EncryptPasswordGUIInterface.cpp
#include <string>
#include "sha.h"
void EncryptPassword(const std::string& username, std::string& password)
{
const int DIGESTSIZE = SHA_DIGEST_SIZE;
const int ITERATIONS = 1337;
static const byte salt_base[DIGESTSIZE] = {
244, 243, 249, 244, 32, 33, 34, 35, 10, 11, 12, 13, 14, 15, 16, 17,
You can’t perform that action at this time.