Skip to content

Instantly share code, notes, and snippets.

def get_free_port():
s = socket.socket()
s.bind(('', 0))
port = s.getsockname()[1]
s.close()
return port
@pathologicalhandwaving
pathologicalhandwaving / sqRtAprox.py
Last active November 23, 2021 15:50
sqRtAprox.py.py
# Kristi Short
# Math 180 Numerical Analysis
# Fall 2014
# Square Root Approximation
# Pythonista Version
import math
# prompt user for radicand
n = float(raw_input("Please enter an integer value for the radicand: "))
# Kristi Short
# Math 180 Numerical Analysis
# Fall 2014
# Square Root Approximation
# Pythonista Version
import math
# prompt user for radicand
n = float(raw_input("Please enter an integer value for the radicand: "))
# Kristi Short
# Math 180 Numerical Analysis
# Fall 2014
# Square Root Approximation
# Pythonista Version
import math
# prompt user for radicand
n = float(raw_input("Please enter an integer value for the radicand: "))
# Kristi Short
# Math 180 Numerical Analysis
# Fall 2014
# Square Root Approximation
# Pythonista Version
import math
# prompt user for radicand
n = float(raw_input("Please enter an integer value for the radicand: "))
@pathologicalhandwaving
pathologicalhandwaving / Dropbox File Picker.py
Created October 17, 2015 03:04 — forked from omz/Dropbox File Picker.py
Dropbox File Picker.py
# IMPORTANT SETUP INSTRUCTIONS:
#
# 1. Go to http://www.dropbox.com/developers/apps (log in if necessary)
# 2. Select "Create App"
# 3. Select the following settings:
# * "Dropbox API app"
# * "Files and datastores"
# * "(No) My app needs access to files already on Dropbox"
# * "All file types"
# * (Choose any app name)
@pathologicalhandwaving
pathologicalhandwaving / random_LSFR.cpp
Created October 17, 2015 03:05 — forked from tomkaith13/random_LSFR.cpp
Linear Feedback Shift Register Based uniform random number generator ... it generates 2**32 -1 random numbers
#include<iostream>
using namespace std;
int rand_gen(unsigned int x) {
/*
XOR Linear feedback shift register based random gen
*/
unsigned int a=1;
@pathologicalhandwaving
pathologicalhandwaving / wiki_description.rb
Last active November 23, 2021 15:40 — forked from bshyong/wiki_description.rb
Quick scraper to fetch first paragraph of Wikipedia for a list of topics
require 'open-uri'
require 'nokogiri'
require 'csv'
require 'cgi'
# BASE_URL = 'http://en.wikipedia.org/w/api.php?format=json&action=query&prop=revisions&rvprop=content&titles='
BASE_URL = 'http://en.wikipedia.org/wiki/'
while($input_filename.nil?)
puts "Enter input filename (should be a CSV)"
@pathologicalhandwaving
pathologicalhandwaving / software_for_scientists.md
Created October 17, 2015 03:05 — forked from stared/software_for_scientists.md
Software for scientists: community-edited list of general-purpose software for scientists.

Software for scientists

Some things takes much less time and stress once you know the right tool. Below, there is a community edited list of software for scientists.

Text editors

in General purpose text/code editors. It may be better to have a good editor for everything, than different ones for different languages, scripts, notes.

@pathologicalhandwaving
pathologicalhandwaving / Add as new Reminder.scpt
Created October 17, 2015 03:07 — forked from oliveratgithub/Add as new Reminder.scpt
Add selected Text as new Reminder in Reminders.app
on run {input, parameters}
-- This code comes from http://raduner.ch/blog/
-- To be used with an Automator Service
-- ------------------------------------------------
set inputText to input as string
tell application "Reminders"
set newremin to make new reminder
set name of newremin to inputText
end tell