Skip to content

Instantly share code, notes, and snippets.

@mojalil
mojalil / nounsrc-split-time-converter.js
Created July 5, 2023 04:17
nounsrc split time converter
function convertToTimedelta(splitTime) {
const [minutes, seconds, milliseconds] = splitTime.split(/[:.]/).map(Number);
return minutes * 60 + seconds + milliseconds / 1000;
}
function calculateCumulativeSplitTimes(splitTimes) {
const cumulativeTimes = [];
let cumulativeTime = 0;
for (const splitTime of splitTimes) {
@mojalil
mojalil / nounsrc-split-time-converter.py
Created July 5, 2023 04:14
nounsrc split times converter
# -*- coding: utf-8 -*-
"""NounsRC Time Trail Split Calculator.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1MGXChaKd65X9nnhwAoZ8N8U62oMCU4M1
"""
from datetime import datetime, timedelta
@mojalil
mojalil / gist:7ce057544eacdf6cbf387b1ad366301e
Created June 3, 2020 11:25 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@mojalil
mojalil / pipenv_cheat_sheet.md
Created October 16, 2019 05:53 — forked from bradtraversy/pipenv_cheat_sheet.md
Pipenv cheat sheet for common commands

Pipenv Cheat Sheet

Install pipenv

pip3 install pipenv

Activate

pipenv shell
@mojalil
mojalil / websockets.md
Created September 30, 2018 01:30 — forked from jsomers/websockets.md
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.")

@mojalil
mojalil / git-pull-all
Created July 13, 2018 02:04 — forked from grimzy/git-pull-all
Git pull all remote branches
#!/usr/bin/env bash
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all