Skip to content

Instantly share code, notes, and snippets.

View malhotrachetan's full-sized avatar
💭
💻

Chetan Malhotra malhotrachetan

💭
💻
View GitHub Profile
@jsomers
jsomers / websockets.md
Created September 27, 2018 12:50
Using websockets to easily build GUIs for Python programs

Using websockets to easily build GUIs for Python programs

I recently built a small agent-based model using Python and wanted to visualize the model in action. But as much as Python is an ideal tool for scientific computation (numpy, scipy, matplotlib), it's not as good for dynamic visualization (pygame?).

You know what's a very mature and flexible tool for drawing graphics? The DOM! For simple graphics you can use HTML and CSS; for more complicated stuff you can use Canvas, SVG, or WebGL. There are countless frameworks, libraries, and tutorials to help you draw exactly what you need. In my case, this was the animation I wanted:

high-priority

(Each row represents a "worker" in my model, and each rectangle represents a "task.")

<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>Sefa subscriptions in feedly Cloud</title>
</head>
<body>
<outline text="Companies" title="Companies">
<outline type="rss" text="Tech at Trello" title="Tech at Trello" xmlUrl="https://trello.engineering/feed.xml" htmlUrl="http://tech.trello.com/"/>
<outline type="rss" text="IMVU" title="IMVU" xmlUrl="http://engineering.imvu.com/feed/" htmlUrl="https://engineering.imvu.com"/>
@nrollr
nrollr / MySQL_macOS_Sierra.md
Last active January 31, 2024 14:45
Install MySQL on Sierra using Homebrew

Install MySQL on macOS Sierra

This procedure explains how to install MySQL using Homebrew on macOS Sierra 10.12

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.

Install MySQL

At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :

@rajarsheem
rajarsheem / littlechecker.py
Last active March 23, 2024 18:18
A little code checker tool in python for Java,C,Cpp. Handles compile error, runtime error, accepted, wrong, TLE.
import os, filecmp
codes = {200:'success',404:'file not found',400:'error',408:'timeout'}
def compile(file,lang):
if lang == 'java':
class_file = file[:-4]+"class"
elif lang == 'c':
class_file = file[:-2]
elif lang=='cpp':
@mandiwise
mandiwise / Sync gh-pages + master branches
Last active April 27, 2024 05:41
Keep gh-pages up to date with a master branch
// Reference: http://lea.verou.me/2011/10/easily-keep-gh-pages-in-sync-with-master/
$ git add .
$ git status // to see what changes are going to be commited
$ git commit -m 'Some descriptive commit message'
$ git push origin master
$ git checkout gh-pages // go to the gh-pages branch
$ git rebase master // bring gh-pages up to date with master
$ git push origin gh-pages // commit the changes
@DazWorrall
DazWorrall / Output
Created February 9, 2012 13:06
Testing file upload handling in Flask
in upload handler
in file close
..
----------------------------------------------------------------------
Ran 2 tests in 0.021s
OK