This file contains hidden or 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
| class Control { | |
| float a1, a2, a3, a4, a5, a6; | |
| Control(float a1, float a2, float a3, float a4, float a5, float a6) { | |
| this.a1 = a1; | |
| this.a2 = a2; | |
| this.a3 = a3; | |
| this.a4 = a4; | |
| this.a5 = a5; | |
| this.a6 = a6; |
This file contains hidden or 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
| require 'Date' | |
| class Derangement | |
| @@derangements = Hash.new do |hash, index| | |
| hash[index] = [] | |
| end | |
| def initialize(n) | |
| @random = Random.new |
This file contains hidden or 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
| source 'https://rubygems.org' | |
| gem 'rest-client' | |
| gem 'byebug' |
This file contains hidden or 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 as np | |
| class Estimator: | |
| def __init__(self, x, y): | |
| """ | |
| x -- matrix where each row is a feature vector | |
| y -- vector of labels | |
| """ | |
| self.x = x | |
| self.y = y |
This file contains hidden or 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
| # | |
| # Recursion generating all valid 5 length permutations. | |
| # | |
| def patterns(pattern, i) | |
| if pattern.length == 5 | |
| p_p pattern and return | |
| end | |
| (1..5).each do |v| | |
| if is_valid(pattern[0...i], v) |
This file contains hidden or 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 as np | |
| import cv2 | |
| import os | |
| import pdb | |
| import wave | |
| from array import array | |
| from bisect import bisect | |
| PICTURE_PATH = '~/Downloads/1001-2000/' |
This file contains hidden or 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
| // BreakTheRope challenge on codility | |
| // https://codility.com/programmers/challenges/sulphur2014 | |
| #include <iostream> | |
| #include <vector> | |
| using namespace std; | |
| int solution(vector<int> &A, vector<int> &B, vector<int> &C) { |
This file contains hidden or 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
| # /r/dailyprogrammer #188 hard | |
| @lines = [] | |
| file_enum = File.open('input.txt','rb').each | |
| first_line = file_enum.next | |
| @m, @n = first_line.split(/\W/).map(&:to_i) | |
| @n.times do |i| | |
| line = file_enum.next.split('') | |
| line.map! do |chr| |
This file contains hidden or 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
| # Nice robot voice reading the duration of all your queries on OSX. | |
| ActiveSupport::Notifications.subscribe('sql.active_record') do |*args| | |
| event = ActiveSupport::Notifications::Event.new(*args) | |
| `say #{event.duration}` | |
| end |
NewerOlder