Skip to content

Instantly share code, notes, and snippets.

View SihamAmarouche's full-sized avatar
🏠
Working from home

siham_amaro SihamAmarouche

🏠
Working from home
View GitHub Profile
@guilhermemm
guilhermemm / k_shortest_paths.py
Last active May 12, 2021 02:47
Yen's K-Shortest Path Algorithm for NetworkX. Yen's algorithm computes single-source K-shortest loopless paths for a graph with non-negative edge cost. For more details, see http://en.m.wikipedia.org/wiki/Yen%27s_algorithm
# -*- coding: utf-8 -*-
"""
A NetworkX based implementation of Yen's algorithm for computing K-shortest paths.
Yen's algorithm computes single-source K-shortest loopless paths for a
graph with non-negative edge cost. For more details, see:
http://networkx.github.io
http://en.m.wikipedia.org/wiki/Yen%27s_algorithm
"""
__author__ = 'Guilherme Maia <guilhermemm@gmail.com>'
@aparrish
aparrish / understanding-word-vectors.ipynb
Last active April 29, 2024 17:57
Understanding word vectors: A tutorial for "Reading and Writing Electronic Text," a class I teach at ITP. (Python 2.7) Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aerrity
aerrity / client.js
Last active April 9, 2024 21:33
Node, Express & MongoDB: Button click example
console.log('Client-side code running');
const button = document.getElementById('myButton');
button.addEventListener('click', function(e) {
console.log('button was clicked');
fetch('/clicked', {method: 'POST'})
.then(function(response) {
if(response.ok) {
console.log('click was recorded');
@ChemaCLi
ChemaCLi / pdf-charts-generator.js
Last active November 9, 2023 13:09
Generate PDF with ChartJS and PDFKit
const fs = require('fs')
const tmp = require("tmp");
const PDFDocument = require('pdfkit');
const MemoryStream = require('memorystream');
const { ChartJSNodeCanvas } = require('chartjs-node-canvas');
export async function generatePDFWithCharts() {
// Sample chart with ChartJS
const chartJSNodeCanvas = new ChartJSNodeCanvas({ type: 'png', width: 800, height: 600 });
const configuration = {