Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jakwuh
jakwuh / index.html
Last active February 20, 2016 17:45
Conway's Game of Life
<!DOCTYPE html>
<html>
<head>
<title>Conway's Game of Life</title>
</head>
<body>
<canvas width="300" height="300" id="grid"></canvas>
<button id="start">Start</button>
@jakwuh
jakwuh / mysql.sh
Last active April 26, 2016 18:14
LAMP server configuration
# reset root password
sudo su
service mysql stop
/usr/sbin/mysqld --skip-grant-tables --skip-networking
mysql
FLUSH PRIVILEGES;
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');
/etc/init.d/mysql stop
/etc/init.d/mysql start
# create user for database
@jakwuh
jakwuh / 7industry.md
Last active May 6, 2016 12:37
Open account for other users

A small guide for "Open account for other users" task

  • Create collections/policies & models/policies. Look for previously created collections and models for example.
  • Create appropriate relationship for models/company
initialize: function() {
	this.buildRelation('policies', require('collections/policies'));
}
  • Create views/collection.models/policy, views/app/collections/policies, views/app/layouts/ policies. Also create appropriate templates for these views. Look for previously created views and templates for example.
  • Create routes/app route
@jakwuh
jakwuh / View.hbs
Last active June 14, 2016 23:22
region-extras add block helper support
{{#region "buttonState" defaults=(obj disabled=false) }}
{{button
disabled=disabled
}}
{{/region}}
{{#region "buttonState2" defaults=(obj disabled=false) }}
{{view "../1"
disabled=disabled
}}
{
"Human": "Man",
"Man": {
"home": "Home",
"office": "Office"
},
"Home": ["Building.homeFactory", {
"kitchen": "ManHomeKitchen#clean"
}]
,
@jakwuh
jakwuh / 1_without.js
Created August 5, 2016 01:07
Webpack bundle generator functions
import Header from './components/header';
import TeamCity from 'promise!./services/teamcity';
Promise.all([TeamCity]).then(function(TeamCity) {
// module code
});
[{
"a": "hahaha"
}]
from scipy.optimize import linprog
c = [-6, -3, 2, 1, 14] # x_1 + x_2 - 2x_3 - x_4 -> max
# Ax <= b
A = [[0, 0, 0, 1, 2], [3, 0, 2, 0, -4], [0, -1, 3, 0, 0]]
b = [-4, 25, 6]
x0_bounds = (1, 4)
x1_bounds = (-1, 3)
x2_bounds = (-2, 2)
x3_bounds = (1, 4)
x4_bounds = (-3, 1)
maximize (6a+3b-2c-d-14e) if ((d+2e)=-4; (3a+2c-4e)=25; (-b+3c)=6; 1<=a<=4; -1<=b<=3; -2<=c<=2 ; 1<=d<=4; -3<=e<=1)