This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!*********************************************************************************************************************************** | |
! | |
! D E C 2 F R A C | |
! | |
! Module: DEC2FRAC | |
! | |
! Programmer: David G. Simpson | |
! NASA Goddard Space Flight Center | |
! Greenbelt, Maryland 20771 | |
! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding=utf-8 | |
import pkgutil | |
import encodings | |
# List of possible codecs. | |
# Multibyte unicode is unlikely. Along with other... | |
unlikely_codecs = {"bz2_codec", "uu_codec", "base64_codec", "hex_codec", "zlib_codec", "unicode_escape", | |
"unicode_internal", "utf_16", "utf_16_le", "utf_16_be", "utf_32", "utf_32_be", "utf_32_le", | |
"raw_unicode_escape","punycode","palmos","idna"} | |
found = set(name for imp, name, ispkg in pkgutil.iter_modules(encodings.__path__) if not ispkg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let empty_board = Array2D.init 8 8 (fun i j -> 0) | |
let check_board (board : int[,]) = | |
let queens = [for idx_i in 0..7 do | |
for idx_j in 0..7 do | |
if(board.[idx_i,idx_j] > 0) then | |
yield idx_i,idx_j] | |
//printfn "%A" queens | |
let z = List.length(queens) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//-------------------------------------------------------------------------- | |
// FarRead() | |
//------------------------------------------------------------------------- | |
boolean FarRead (int handle, char far *dest, long length) | |
{ | |
if (length>0xffffl) | |
TrashProg("FarRead doesn't support 64K reads yet!"); | |
asm push ds | |
asm mov bx,[handle] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename T> | |
constexpr T& const_cast_t(const T& p) { | |
using pctype = std::remove_const_t<T>; | |
return const_cast<pctype&>(p); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
import sys,os,subprocess | |
import climate | |
def printer(filename,printer_ip= "192.168.0.50"): | |
_rc0 = _rcr1, _rcw1 = os.pipe() | |
if os.fork(): | |
os.close(_rcw1) | |
os.dup2(_rcr1, 0) | |
subprocess.call(["nc",printer_ip,"9100"],shell=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
w x r=d:w(100*(x-20*r*d-d*d))(10*r+d) | |
where d=head(filter(\d -> 20*r*d+d*d>=x)[0..])-1 | |
sqrt_digits n = w n 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
span.cdd { | |
color: #ff0000; | |
} | |
span.c88 { | |
color: #001aff; | |
} | |
span.cae p { | |
color: #7d107d; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy | |
import scipy | |
import scipy.optimize | |
def latlon_system(d1, my_phi1, my_lambda1, d2, my_phi2, my_lambda2): | |
""" | |
Non-linear objective function to solve for lat,long of unknown, given | |
known positions and distances... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function q = cauchyEstimator(x) | |
N = numel(x); | |
A = @(t) sum(1 ./ (t(1) - x + t(2) .^ 2) .^ 2); | |
B = @(t) 2 * t(2) * sum(1 ./ (t(1) - x + t(2) .^ 2) .^ 2); | |
D = @(t) -(N - 2 * sum(1 ./ (t(1) - x + (t(2) ^ 2)) .^ 2 .* ((t(2) .^ 2) - t(1) + x)) * t(2) .^ 2) ./ t(2) .^ 2; | |
J = @(t) [A(t) B(t); B(t) D(t)]; | |
F = @(t)[-sum((2 * t(1) - 2 .* x) ./ ((t(1) - x) .* (t(1) - x) + t(2)*t(2))),N/t(2)-sum(2*t(2)./((t(1)-x).^2+t(2)^2))]; | |
OlderNewer