Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| ############### | |
| # $ . # | |
| # ### . # | |
| # # ##### # | |
| # # ####+$ #$ # | |
| # # # # | |
| # ########## # | |
| # # | |
| ############### |
| """making a dataframe""" | |
| df = pd.DataFrame([[1, 2], [3, 4]], columns=list('AB')) | |
| """quick way to create an interesting data frame to try things out""" | |
| df = pd.DataFrame(np.random.randn(5, 4), columns=['a', 'b', 'c', 'd']) | |
| """convert a dictionary into a DataFrame""" | |
| """make the keys into columns""" | |
| df = pd.DataFrame(dic, index=[0]) |
| class Graph: | |
| def __init__(self): | |
| self.nodes = set() | |
| self.edges = defaultdict(list) | |
| self.distances = {} | |
| def add_node(self, value): | |
| self.nodes.add(value) | |
| def add_edge(self, from_node, to_node, distance): |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| class Board(object): | |
| """ | |
| >>> Board().rows | |
| ((' ', ' ', ' '), (' ', ' ', ' '), (' ', ' ', ' ')) | |
| >>> print Board() | |
| | | | |
| ----- | |
| | | | |
| ----- |
| #!/bin/bash | |
| # brew install x265 | |
| # brew install ffmpeg | |
| # brew install youtube-dl | |
| # brew install imagemagick | |
| ID='U65_uY5N2WM' # YouTube video ID, i.e. https://www.youtube.com/watch?v={ID} | |
| # fetch the video file with youtube-dl |
korn.c is the "Best One Liner" winner of the 1987 International Obfuscated C Code Contest, by David Korn (yes, the author of the Korn Shell).
korn.hint, as the name implies, offers some hints.
A commenter on Stack Overflow asked for some clarification. I didn't want to post spoilers on the site, so I'm posting them here instead. If you haven't already (and if you're familiar with the rules of C) I encourage you to study the program for a while first.
=====
Here's the code:
| ffmpeg -i input.mp3 -acodec pcm_s16le -ac 1 -ar 16000 output.wav | |
| # To convert all mp3 files in a directory in Linux: | |
| for f in *.mp3; do ffmpeg -i "$f" -acodec pcm_s16le -ac 1 -ar 16000 "${f%.mp3}.wav"; done | |
| # Or Windows: | |
| for /r %i in (*) do ffmpeg -i %i -acodec pcm_s16le -ac 1 -ar 16000 %i.wav |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| from scipy.spatial import Voronoi | |
| def voronoi_finite_polygons_2d(vor, radius=None): | |
| """ | |
| Reconstruct infinite voronoi regions in a 2D diagram to finite | |
| regions. | |
| Parameters |
| #!/usr/bin/env python | |
| import sys | |
| import cv2 | |
| import subprocess | |
| from subprocess import call | |
| import aalib | |
| import Image |