Skip to content

Instantly share code, notes, and snippets.

@kylemcdonald
kylemcdonald / convert.py
Last active May 25, 2024 19:24
Scrape ShaderToy. Instead of running this, consider downloading the files from here: https://goo.gl/MWGvkL Or if you want to do more work with ShaderToy data, consider using their API https://www.shadertoy.com/api
# !/usr/bin/env python
import os, re, argparse, json
parser = argparse.ArgumentParser(
description='Extract code from ShaderToy json.')
parser.add_argument('input')
parser.add_argument('output')
args = parser.parse_args()
@CMCDragonkai
CMCDragonkai / parallel_curl.sh
Last active April 22, 2024 16:03
Bash: GNU Parallel with Curl
# do it once
seq 1 | parallel -n0 "curl -H 'Content-Type: application/json' http://httpbin.org/post -X POST -d '{\"url\":\"http://google.com/\"}'"
# do it twice
seq 2 | parallel -n0 "curl -H 'Content-Type: application/json' http://httpbin.org/post -X POST -d '{\"url\":\"http://google.com/\"}'"
# do it 4 times, but at 2 a time
seq 4 | parallel -n0 -j2 "curl -H 'Content-Type: application/json' http://httpbin.org/post -X POST -d '{\"url\":\"http://google.com/\"}'"
# you can also put all your commands into a file
@HaiyangXu
HaiyangXu / Server.py
Created May 18, 2014 14:00
A simper python http server can handle mime type properly
# -*- coding: utf-8 -*-
#test on python 3.4 ,python of lower version has different module organization.
import http.server
from http.server import HTTPServer, BaseHTTPRequestHandler
import socketserver
PORT = 8080
Handler = http.server.SimpleHTTPRequestHandler