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 Control.Concurrent | |
import System.Process | |
import System.Environment | |
say str = system $ "say '" ++ str ++ "'" | |
timer :: Int -> IO () | |
timer 1 = do | |
say "one minute left! oh crap!" | |
threadDelay $ 30 * 1000 * 1000 |
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 Control.Applicative | |
import Github.Gists | |
import Github.Users.Followers | |
import System.Directory | |
import Control.Monad | |
import qualified Data.Set as S | |
import Text.Printf | |
import System.Process | |
import System.IO.Unsafe |
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
trap("SIGINT") do | |
puts "goodbye!" | |
# exit | |
end | |
while true | |
end |
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
def generate_valid_isbn | |
prefix = 978.to_s # must be 978 or 979 | |
registration_group_element = rand(10).to_s | |
registrant_element = (rand(90000) + 10000).to_s | |
publication_element = (rand(900) + 100).to_s | |
_isbn = prefix + registration_group_element + registrant_element + publication_element | |
check_digit = 0 | |
i = 0 | |
_isbn.each_char do |letter| | |
i+= 1 |
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 ruby | |
require 'tempfile' | |
def make_row cols, style="" | |
"<tr style='#{style}'><td>" + cols.join("</td><td>") + "</td></tr>" | |
end | |
if ARGV.empty? | |
puts %{ | |
Usage: #{$0} [file] where file has col list for a hive table, then a blank line, then some sample rows |
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
% my training data. | |
% so if x > 3 || x < 7, y = 1, otherwise y = 0. | |
x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; | |
y = [0, 0, 0, 1, 1, 1, 0, 0, 0, 0]; | |
% instead of theta' * x, I'm trying to create | |
% a non-linear decision boundary. | |
function result = h(x, theta) | |
result = sigmoid(theta(1) + theta(2) * x + theta(3) * ((x - theta(4))^2)); | |
end |
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
x = [1000, 2000, 4000]; | |
y = [200000, 250000, 300000]; | |
% given a theta_0 and theta_1, this function calculates | |
% their cost. We don't need this function, strictly speaking... | |
% but it is nice to print out the costs as gradient descent iterates. | |
% We should see the cost go down every time the values of theta get updated. | |
function distance = cost(theta) | |
theta_0 = theta(1); | |
theta_1 = theta(2); |
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
diff --git a/src/Phan/Analysis/PreOrderAnalysisVisitor.php b/src/Phan/Analysis/PreOrderAnalysisVisitor.php | |
index 8650cd3..feaaee4 100644 | |
--- a/src/Phan/Analysis/PreOrderAnalysisVisitor.php | |
+++ b/src/Phan/Analysis/PreOrderAnalysisVisitor.php | |
@@ -508,11 +508,16 @@ class PreOrderAnalysisVisitor extends ScopeVisitor | |
*/ | |
public function visitIfElem(Node $node) : Context | |
{ | |
+ $closure_fqsen = | |
+ FullyQualifiedFunctionName::fromClosureInContext( |
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/sbin/dtrace -s | |
#pragma D option quiet | |
#pragma D option defaultargs | |
#pragma D option switchrate=10hz | |
/* from http://dtrace.org/blogs/brendan/2011/10/10/top-10-dtrace-scripts-for-mac-os-x/ */ | |
dtrace:::BEGIN | |
{ |
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
% my training data. | |
% so if x > 3 || x < 7, y = 1, otherwise y = 0. | |
x = 1:100; | |
y = [0, 0, 0, 1, 1, 1, 1, zeros(1, 93)]; | |
% instead of theta' * x, I'm trying to create | |
% a non-linear decision boundary. | |
% So instead of y = theta_0 + theta_1 * x, I use: | |
function result = h(x, theta) | |
result = sigmoid(theta(1) + theta(2) * x + theta(3) * ((x - theta(4))^2)); |