Skip to content

Instantly share code, notes, and snippets.

import pandas as pd
import numpy as np
def get_dataset(size):
# Create Fake Dataset
df = pd.DataFrame()
df['size'] = np.random.choice(['big','medium','small'], size)
df['age'] = np.random.randint(1, 50, size)
df['team'] = np.random.choice(['red','blue','yellow','green'], size)
df['win'] = np.random.choice(['yes','no'], size)
@psiborg
psiborg / web-servers.md
Created May 20, 2021 03:14 — forked from willurd/web-servers.md
Big list of http static server one-liners

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.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@psiborg
psiborg / ffmpeg.md
Created October 20, 2020 02:04 — forked from protrolium/ffmpeg.md
ffmpeg guide

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

@psiborg
psiborg / .bash_profile
Created September 20, 2019 17:33 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
<p class="results"></p>
<ol>
<li>
<p>Name: Alabama</p>
<p>Capital Name: Montgomery</p>
<p>Capital Latitude: 32.361538</p>
<p>Capital Longitude: -86.279118</p>
</li>
<li>
<p>Name: Alaska</p>
/** Vertical Align element **/
.element {
position: relative;
top: 50%;
transform: translateY(-50%);
}
@psiborg
psiborg / distance_2_poins.js
Created January 15, 2014 10:08 — forked from Dexterstat/distance_2_poins.js
Calculate the distance between 2 points on Google Maps
function distance(lat1,lon1,lat2,lon2) {
var R = 6371; // km (change this constant to get miles)
var dLat = (lat2-lat1) * Math.PI / 180;
var dLon = (lon2-lon1) * Math.PI / 180;
var a = Math.sin(dLat/2) * Math.sin(dLat/2) +
Math.cos(lat1 * Math.PI / 180 ) * Math.cos(lat2 * Math.PI / 180 ) *
Math.sin(dLon/2) * Math.sin(dLon/2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
var d = R * c;
if (d>1) return Math.round(d)+"km";
<!DOCTYPE html>
<html>
<head>
<title>Queueing Asynchronous Functions in JavaScript</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="queue.js"></script>
</head>
<body>
<p><input type="button" id="process-button" value="Process Queue" /></p>
<div id="output"></div>
function Queue() {
this.reset();
}
Queue.prototype.dequeue = function () {
if (this.empty() !== true) {
this.length -= 1;
return this.items.shift();
}
return undefined;
@psiborg
psiborg / window.console.js
Created August 7, 2012 03:32 — forked from bforrest/window.console.js
console log javascript snippet
if (!window.console) {
(function() {
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
"group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
window.console = {};
for (var i = 0; i < names.length; ++i) {
window.console[names[i]] = function() {};
}
}());
}