Skip to content

Instantly share code, notes, and snippets.

View waspinator's full-sized avatar
🎯
Focusing

waspinator waspinator

🎯
Focusing
View GitHub Profile
//
// FireworksEffect - Free for all use from Davepl
//
// Fireworks Effect for Fourth of July
public class FireworksEffect : LEDEffect
{
// Each particle int the particle system remembers its color,
// birth time, postion, velocity, etc. If you are not using DateTime,
// all you need in its place is a number of seconds elapsed, which is
<?php
namespace App\Model\Entity;
#use Cake\Auth\DefaultPasswordHasher;
use Authentication\PasswordHasher\DefaultPasswordHasher;
use Authorization\IdentityInterface;
use Cake\ORM\Entity;
/**
* User Entity
@waspinator
waspinator / create_mnist_with_keras.py
Created December 14, 2018 15:37
generate mnist images using keras
from keras.datasets import mnist
from PIL import Image
(x_train, y_train), (x_validate, y_validate) = mnist.load_data()
dataset_train = {'inputs': x_train, 'labels': y_train}
dataset_validate = {'inputs': x_validate, 'labels': y_validate}
for index, i in enumerate(dataset_train['inputs']):
im = Image.fromarray(i)
@waspinator
waspinator / install_dhcp.md
Last active October 2, 2018 14:41
dhcp server setup ubuntu 16.04

Install the dhcp server

sudo apt-get install isc-dhcp-server

Edit dhcp server settings

Configuration files:

  • /etc/default/isc-dhcp-server
  • /etc/dhcp/dhcpd.conf
@waspinator
waspinator / test.bib
Last active July 4, 2018 23:17
broken BibLaTeX encoding
@article{test_2018,
title = {Test—with a dash},
volume = {62},
issn = {1231-1231},
url = {http://ww.google.com},
doi = {11.1111/1111-1111(11)11111-P},
abstract = {Test},
pages = {11-111},
number = {111},
journaltitle = {Test},
@waspinator
waspinator / API.md
Created May 9, 2017 13:22 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@waspinator
waspinator / pyqt_thread.py
Created November 30, 2016 17:06
pyqt thread example
import random
import sys
from PyQt5 import QtWidgets, uic, QtCore, QtGui
class Worker(QtCore.QThread):
data = QtCore.pyqtSignal(dict)
def __init__(self, parent=None):
super(Worker, self).__init__(parent)
public function password($id = null)
{
$user = $this->Users->get($id);
if ($this->request->is(['patch', 'post', 'put'])) {
$user = $this->Users->patchEntity($user, $this->request->data);
if ($this->request->is(['ajax'])) {
if ($this->Users->save($user)) {
} else {
// UsersController.php
public function edit($id = null)
{
$user = $this->Users->get($id);
if ($this->request->is(['patch', 'post', 'put'])) {
$user = $this->Users->patchEntity($user, $this->request->data);
if ($this->Users->save($user)) {
$this->Flash->success('The user has been saved.');
@waspinator
waspinator / designer.html
Last active August 29, 2015 14:15
designer
<link href="../topeka-elements/topeka-resources.html" rel="import">
<link href="../topeka-elements/topeka-profile.html" rel="import">
<polymer-element name="my-element">
<template>
<style>
#design_host {
position: absolute;
width: 100%;