Skip to content

Instantly share code, notes, and snippets.

@dmishin
dmishin / tsp_conjecture_counterexample.py
Created November 11, 2023 23:51
Use linear programming to find counterexample for a conjecture regarding the Traveling Salesman Problem
from scipy.optimize import linprog
import numpy as np
import itertools
#Searching for the counterexample for the following conjecture:
# in the shortest hamiltonian path, there is at least one
# node, connected to its 12 nearest neighbors
# https://www.reddit.com/r/math/comments/17rxc28/travelling_salesman_algorithm/
# Use linear programming to find a counterexample
@44213
44213 / ffmpeg-commands.sh
Created September 17, 2021 19:51 — forked from rowe-morehouse/ffmpeg-commands.sh
ffmpeg commands.
# To extract the sound from a video and save it as MP3:
ffmpeg -i <video.mp4> -vn <sound>.mp3
# To convert frames from a video or GIF into individual numbered images:
ffmpeg -i <video.mpg|video.gif> <frame_%d.png>
# To combine numbered images (frame_1.jpg, frame_2.jpg, etc) into a video or GIF:
ffmpeg -i <frame_%d.jpg> -f image2 <video.mpg|video.gif>
# To quickly extract a single frame from a video at time mm:ss and save it as a 128x128 resolution image:
@souporserious
souporserious / getJSONFromFigmaFile.js
Created July 13, 2018 21:52
Generates JSON from Figma file
import request from 'request'
const api_endpoint = 'https://api.figma.com/v1'
const personal_access_token = 'FIGMA_ACCESS_TOKEN_HERE' // https://www.figma.com/developers/docs#auth-dev-token
function downloadSvgFromAWS(url) {
return new Promise((resolve, reject) => {
request.get(
url,
{
@cpietsch
cpietsch / README.md
Last active December 30, 2023 04:16
d3.js map with markers

Easy example on how to put marker on a d3.js map.

You got 2 options:

  • using d3.geo.path() which does all the work for you
  • using svg circles and translating them via projection(d.geometry.coordinates)
@brattonc
brattonc / README.md
Last active November 20, 2023 17:14
D3 Liquid Fill Gauge

Liquid Fill Gauge v1.1 - 7/14/2015

Changes:

  • Added support for updating the gauge value after loading is complete. The loadLiquidFillGauge method now returns an object with an update method which allows the gauge value to be changed. Click any of the gauges above to randomly update their value.

Configurable features include:

  • Changeable min/max values.
  • All colors.
@stuartlangridge
stuartlangridge / TypeFileOut.py
Created January 9, 2014 16:11
Sublime Text 2 Python plugin to "type" the file that's currently being edited, character by character, for screencasts.
import sublime, sublime_plugin
BLOCKLEN = 4
class TypeFileOutCommand(sublime_plugin.TextCommand):
def nextchar(self):
if self.body:
totype = []
while 1:
try: