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
| /* -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- */ | |
| // DO NOT EDIT THIS FILE, it will be overwritten on update | |
| // | |
| // Default rules for polkit | |
| // | |
| // See the polkit(8) man page for more information | |
| // about configuring polkit. | |
| polkit.addRule(function(action, subject) { |
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
| #include <initializer_list> | |
| #include <utility> | |
| #include <string> | |
| void d(std::initializer_list<std::pair<std::string&, const char*>> dirs) { | |
| for (auto k : dirs) { | |
| k.first = k.second; | |
| } | |
| } |
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
| bool StringMatch(const char *str, size_t strn, | |
| const char *pat, size_t patn) | |
| { | |
| size_t stri = 0; | |
| for (size_t i = 0; i < patn; ++i) { | |
| switch (pat[i]) { | |
| case '?': | |
| if (stri < strn) { | |
| stri += 1; |
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
| bool StringCompare(string a, string b) { | |
| char *aa = strdup(a.c_str()); | |
| char *bb = strdup(b.c_str()); | |
| if (strcmp(aa, bb) == 0) { | |
| return true; | |
| } else { | |
| return false; | |
| } | |
| } |
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
| (let ((divisible (lambda (n d) (= 0 (remainder n d))))) | |
| (let A ((i 1)) | |
| (if (<= i 100) | |
| (begin | |
| (format #t "~a\t~a~a\n" | |
| i | |
| (if (divisible i 3) "fizz" "") | |
| (if (divisible i 5) "buzz" "")) | |
| (A (+ 1 i)))))) | |
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
| open Core.Std | |
| type cell_state = Alive | Dead | |
| (* C N new C *) | |
| (* 1 0,1 -> 0 # Lonely *) | |
| (* 1 4,5,6,7,8 -> 0 # Overcrowded *) | |
| (* 1 2,3 -> 1 # Lives *) | |
| (* 0 3 -> 1 # It takes three to give birth! *) | |
| (* 0 0,1,2,4,5,6,7,8 -> 0 # Barren *) |
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
| open Core.Std | |
| type cell_state = Alive | Dead | Out_of_bound | |
| (* C N new C *) | |
| (* 1 0,1 -> 0 # Lonely *) | |
| (* 1 4,5,6,7,8 -> 0 # Overcrowded *) | |
| (* 1 2,3 -> 1 # Lives *) | |
| (* 0 3 -> 1 # It takes three to give birth! *) | |
| (* 0 0,1,2,4,5,6,7,8 -> 0 # Barren *) |
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 "core" *) | |
| open Core.Std | |
| exception Bad_argument | |
| let is_prime1 n = | |
| if n < 2 then | |
| false | |
| else | |
| let rec isp 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
| (* #require "num";; *) | |
| let fib n = | |
| let rec helper n2 a b = | |
| if n2 = 1 then b else helper (n2 - 1) b (a + b) | |
| in helper n 0 1;; | |
| let fib_big n = | |
| let rec helper n2 a b = | |
| if n2 = 1 then b else helper (n2 - 1) b (Big_int.add_big_int a b) |
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
| type gender = Man | Woman | |
| type human = Any of gender | Special of gender * string | B4283 | |
| type marry_result = HappilyEverAfter | ForeverAlone | DontKnowHowToMakeLoveStop | |
| let marry x y = match (x, y) with | |
| | (B4283, B4283) -> DontKnowHowToMakeLoveStop | |
| | (Special (ag, an), Special (bg, bn)) | |
| when ag = bg && an = bn -> DontKnowHowToMakeLoveStop | |
| | (B4283, _) -> ForeverAlone | |
| | (_, B4283) -> ForeverAlone |