├── _config.yml ├── python ├── Priultimus_that.py ├── hello │ ├── antonio32a_world.py │ ├── Kmek_hello.py │ └── jaakofalltrade_helloworld.py ├── reverse │ ├── dhruvs009_strrev.py │ ├── earvingemenez_reverse_sentence.py │ ├── Cadarn_reverse_string.py │ └── bigboynaruto_reverse_sentence.py ├── mirandars_parity-test.py ├── amanagarwal-sopho_sum_of_digits.py ├── Kartikaggarwal98_string_padding.py ├── prime │ ├── JoaoRacedo_Prime_Check.py │ └── falafel72_get-primes.py ├── mspatel927_Mirror_List.py ├── Kartikaggarwal98_create_dict_from_two_lists.py ├── Kartikaggarwal98_display_calendar.py ├── anagram │ ├── bsanders_anagram.py │ ├── nikhilhassija_anagram-one-liner.py │ └── s-ankur_decode_anagram.py ├── earvingemenez_format_currency.py ├── even │ └── ThaLeprechaun_list_of_odd_numbers.py ├── mspatel927_Random_Card_Draw.py ├── AghastComet_fahrenheit_to_celsius.py ├── mirandars_par-perfect-squares.py ├── cricketer94_transpose.py ├── kblicharski_merge_dictionaries.py ├── melissachen2000_derivative.py ├── fibonacci │ ├── MaheshSuranga_fibonanci.py │ ├── moore3071_binet_fibonacci.py │ ├── BrunoGomesCoelho_fibonacci.py │ ├── nikhilhassija_fibonacci-one-liner.py │ ├── brianhopper_fib_one-Liner.py │ └── jamlamberti_fibonacci_seq.py ├── AndreaChlebikova_double_factorial.py ├── kblicharski_strip_file_of_whitespace.py ├── sourabhlal_distance_two_points.py ├── JoaoRacedo_Matrix_Transpose.py ├── OpticGenius_list_files.py ├── ShaneCreedon_dict_of_squares.py ├── factorial │ └── factorial_n6wbi6.py ├── devarakondapranav_multiply_without_arithmeticAndBinary.py ├── unique │ ├── RaInta_unique_array.py │ ├── yashagarwal1999_unique_array.py │ ├── Zylatis_uncommon_elements.py │ ├── Kaljuk_get_word_with_most_unique_characters.py │ └── moonblade_twoStrings.py ├── approximate_e │ └── ServinDC_approximate_e.py ├── earvingemenez_get_age.py ├── andrus14_leap_year.py ├── approximate_pi │ ├── AghastComet_approximate_pi.py │ └── yashagarwal1999_get_Approximate_Pi.py ├── golden_ratio │ ├── Ribodou_phi.py │ └── leaen_golden_ratio.py ├── Kartikaggarwal98_frequency_elements.py ├── earvingemenez_generate_password.py ├── kennedy_squaresum_diff_sumsquare.py ├── sorting │ ├── Nitish18_list_key_based_sorting.py │ ├── blicharski_print_sorted_environment_variables.py │ ├── cricketer94_quicksorty.py │ ├── OpticGenius_sort-files-date.py │ ├── ngweihow_bogosort.py │ └── blicharski_select_sort_1_line.py ├── kblicharski_create_directories.py ├── blitzh0t_vowels.py ├── kennedy_emotions.py ├── palindrome │ └── melissachen2000_palindrome_checker.py ├── JoaoRacedo_Set_All_Subsets.py ├── Kartikaggarwal98_iterate_multiple_lists.py ├── moonblade_day.py ├── kblicharski_search_file_for_keyword.py ├── mspatel927_Greater_Than.py ├── blitzh0t_consonants.py ├── kennedy_sum_multiples_of_a_b_less_than_x.py ├── predator21x_The-largest_number_that_can_be_represented_by_8_Byte.py ├── priyankadalmia_factorial.py ├── bhavikb07_Factors.py ├── JayWelborn_similar_strings.py ├── predator21x_decimal_conversion.py ├── ColeHoff7_hamming_distance.py ├── BrunoGomesCoelho_dot_product.py ├── RaInta_e_to_pi.py ├── melissachen2000_find_missing_number.py ├── jamlamberti_pascals_triangle.py ├── ColeHoff7_one-line-slot-machine.py ├── OpticGenius_longest-one-liner.py ├── gsafcik_largest_sum_consecutive_nums_in_array.py ├── melissachen2000_fizzbuzz.py ├── jamlamberti_pascals_triangle2.py ├── OpticGenius_group-file-extensions.py ├── yashagarwal1999_powerset.py ├── valley │ ├── moonblade_countingValley.py │ └── chrismclennon_countingValley-2.py ├── OpticGenius_count-filename-letters.py ├── adriennelevvie_show2019.py ├── Priultimus_day.py ├── caesar │ └── s-ankur_caesar.py ├── moonblade_leftRotate.py ├── s-ankur_xor_cipher.py ├── BrunoGomesCoelho_matrix_multiplication.py ├── michaelbuchar_AddTwoNumbers.py ├── prathimacode-hub_ordered_prepend_string_num.py ├── BrunoGomesCoelho_ackermann_function.py └── moonblade_luckBalance.py ├── perl ├── mattchuranu_list-files.p6 ├── prime │ └── Ojaswy_prime.pl ├── hello │ ├── mattchuranu_hello-world.p6 │ └── Cyclenerd_hello-world.pl ├── mattchuranu_log2n.p6 ├── mattchuranu_gcd.p6 ├── mattchuranu_ask-for-filename-until-given-one-that-doesnt-exist.p6 ├── remove_duplicates.pl └── fibonacci │ └── mattchuranu_fibonacci-sequence-to-the-nth-number.p6 ├── php ├── AmosGarner_printBinary.php ├── AmosGarner_printRandomNumbers.php ├── AmosGarner_getMax.php ├── even │ └── ericksuryadinata_even_odd.php ├── fibonacci │ └── hugonun_fibonacci.php ├── adeojoemmanuel_checkSession.php ├── adeojoemmanuel_getmin.php ├── adeojoemmanuel_daysinamonth.php ├── ericksuryadinata_simple_-1+2-3+4.php └── adeojoemmanuel_twocondition.php ├── r ├── hello │ └── vghorakavi_hello.r ├── prime │ └── KKulma_find-prime-number.R ├── Bassoon08_remove_NaN.r ├── devAmoghS_excel_dates_to_r.r └── MattSandy_print_loaded_packages.r ├── javascript ├── SatioO_head.js ├── rpxs_add.js ├── dorman99_split.js ├── even │ ├── jackkav_isEven.js │ └── jackkav_isOdd.js ├── toluwalope19_spread.js ├── rpxs_subtract.js ├── sowhatdoido_isTruthy.js ├── vetlix_empty_array.js ├── reverse │ ├── saxenanamay_reverse_array.js │ ├── romellogoodman_reverse_sentence.js │ ├── romellogoodman_reverse_string.js │ ├── wzhouwzhou_reverse-string.js │ └── rrrepsaj_reverse_string_with_reduce.js ├── vetlix_deepflat_array.js ├── bhirmbani_copy_object.js ├── devshawn_take.js ├── romellogoodman_copy_array.js ├── bgail_get_min.js ├── sorting │ ├── jibinkmathew94_sort_one_line_array.js │ ├── igemnace_selection_sort.js │ └── akargl_insertion_sort.js ├── unique │ ├── ananta_unique_array.js │ ├── niralpokal_getUniqueArrayValues.js │ ├── jackkav_two_strings.js │ ├── wzhouwzhou_unique_values.js │ └── jagwiredev_remove_duplicates.js ├── Priultimus_sum_of_ints.js ├── fibonacci │ ├── matankb_fibonacci.js │ └── audrius59_fibonacci2.js ├── hello │ ├── vamisola_hello.js │ └── wzhouwzhou_hello-world-backwards.js ├── matankb_sum_of_range.js ├── RanveerSinghKhattra_get_user_input.js ├── devshawn_find_key.js ├── devshawn_random.js ├── romellogoodman_html_strip.js ├── shuffle_array.js ├── wzhouwzhou_multiply_ints.js ├── devshawn_drop.js ├── dhaveed_swap_variables.js ├── tiffany-jao_isTriangle.js ├── sowhatdoido_get_mean.js ├── Kaljuk_get_min2.js ├── Xander1233_collatzConjecture.js ├── Kaljuk_max_difference_math.js ├── bramleyjl_max_difference.js ├── ZombieChibiXD_Palindrome.js ├── sowhatdoido_withoutValue.js ├── jackkav_hex2rgb.js ├── johnfoderaro_get_random_key.js ├── dhaveed_pad_zeros.js ├── jackkav_get_frequency.js ├── capJavert_is-touch-device.js ├── jjroush_map_filter_reduce.js ├── approximate_e │ ├── dinThea_approximate_e.js │ └── akargl_approx_e.js ├── mraymond_generate_list_of_numbers.js ├── sareeshv_escape_html.js ├── niralpokal_isEmptyObject.js ├── vr1e_Kaljuk_get_max.js ├── romellogoodman_page_query_params.js ├── approximate_pi │ └── akargl_approx_pi.js ├── Xander1233_convert_number_to_one_or_bigger.js ├── tnptop_tuplesToObject.js └── wzhouwzhou_check_brackets.js ├── bash ├── hello │ ├── Kmek_hello.sh │ └── Sourabh950_hello.sh ├── Mohammed Nisham_ip.sh ├── icedream_ip_awk.sh ├── Mohammed Nisham_generatePassword.sh ├── pbootly_fizzbuzz.sh ├── dinhnv_colors.sh ├── suksit_remove-unused-docker-images.sh ├── devAmoghS_directories_tree_view.sh ├── antoooks_print_top_10_user_agents_from_access_log.sh ├── OpticGenius_longest.sh ├── Andrus_thumbnail_from_pdf_page.sh ├── ngweihow_shortest.sh ├── approximate_pi │ └── pbootly_machin-pi-approximation.sh └── jackkav_retry_until.sh ├── c ├── hello │ ├── dchenmei_hello.c │ └── n6wbi6_hello_world.c ├── RanveerSinghKhattra_creating_alert_sound.c ├── HarshitaArun_Swap.c ├── cyucelen_fizzbuzz.c ├── gcd │ └── shubhamdpatil_gcd.c ├── fibonacci │ └── renanreboredo_fibonacci.c ├── swap │ └── shubhamdpatil_swap.c ├── approximate_pi │ └── cyucelen_pi_wallis_product.c ├── caesar │ └── s-ankur_caesar.c ├── palindrome │ └── GeoffYart_palindrome_check.c ├── bigboynaruto_one_lineifier.c ├── sorting │ └── isears_bubblesort.c └── prime │ └── serjche_isPrime.c ├── clojure └── hello │ └── effi-t_hello-world.clj ├── coffeescript ├── wzhouwzhou_add.coffee ├── wzhouwzhou_subtract.coffee ├── hello │ ├── wzhouwzhou_hello-world.coffee │ ├── wzhouwzhou_hello-scramble.coffee │ └── wzhouwzhou_hello-functions.coffee ├── palindrome │ └── wzhouwzhou_number-palindrome.coffee └── wzhouwzhou_isTruthy.coffee ├── go ├── wzhouwzhou_add.go ├── fibonacci │ └── hurlenko_fibonacci.go ├── approximate_e │ └── hurlenko_approximate_e.go ├── approximate_phi │ └── hurlenko_approximate_phi.go ├── sorting │ └── isears_bubblesort.go └── approximate_pi │ └── hurlenko_approximate_pi.go ├── ocaml ├── hello │ └── AnkitaBIT_hello.ml └── rk4n_ycombinator.ml ├── .travis.yml ├── haskell ├── reverse │ └── joaoportela_reverse.hs ├── Ojaswy_pascal.hs ├── bbyalcinkaya_quine.hs ├── rsconsuegra_pithagor_trip.hs ├── sorting │ └── george1410_quicksort.hs ├── palindrome │ └── rsconsuegra_palindromic_product.hs ├── fibonacci │ └── dshimo_fibonacci.hs └── prime │ └── ngweihow_primenumbers.hs ├── typescript └── hello │ └── JuanPabloHuertas_hello-world.ts ├── pascal └── hello │ └── kannagikazuko_hello-world.pas ├── honorary-one-line-wonders ├── python │ ├── String_Reversal.py │ ├── convert_to_csv.py │ ├── GenerateFibonacciSeq.py │ ├── discord-bot.py │ ├── Fibonacciseries.py │ ├── reversePy_subratred.py │ ├── verify_variable_type.py │ ├── SeiveOfEratosthenes.py │ ├── merge.py │ ├── validAnagram.py │ ├── semiprime.py │ ├── flames.py │ ├── eapprox.py │ ├── baseconversion_from_base_2_to_32.py │ └── tic-tac-toe.py ├── javascript │ ├── isPrime.js │ ├── memoize.js │ ├── golden_ratio.js │ ├── fibonnacci2.js │ ├── vetlix_array_map.js │ ├── sayoojtmc_timer.js │ ├── get_frequency.js │ ├── magnitude.js │ ├── largest_contigous_sum_array.js │ ├── random_alphanumeric.js │ └── ycombinator.js ├── c │ ├── hello │ │ └── juricav_helloWorld.c │ ├── one_lineifier.c │ └── codetheorem_mergesort.c ├── cplusplus │ ├── hello │ │ └── juricav_helloWorld.cpp │ ├── e_approximation.cpp │ ├── factorial.cpp │ ├── fib.cpp │ ├── U3X_check_square.cpp │ ├── yashagarwal1999_countingValley.cpp │ ├── yashagarwal1999_Largest _sum_of_consecutive_numbers_in_an_array.cpp │ ├── cchha.cpp │ ├── yashagarwal1999_powerset.cpp │ └── mergeSort.cpp ├── powershell │ ├── hello-old.ps1 │ └── download_and_install_7-zip.ps1 ├── rust │ └── fibonacci.rs ├── nodejs │ └── fibonacci_inMemory.js ├── go │ └── approximate_pi.go ├── coffeescript │ └── ytsearcher-example.coffee ├── crystal │ └── http_server.cr ├── clojure │ └── ycombinator.clj ├── html │ └── Hello_World.html ├── java │ ├── ValidAnagram.java │ └── AnagramChecker.java ├── haskell │ └── mergesort.hs ├── cpp │ ├── Fibonacci in cpp.cpp │ └── anagram.cpp └── README.md ├── vim └── igemnace_multiply_ints.vim ├── nodejs ├── hello │ ├── kannagikazuko_hello_world.js │ └── austinkregel_hello_world.js ├── wzhouwzhou_delay.js ├── tacticaltechjay_coinFlip.js ├── NguyenDa18_new_server.js └── austinkregel_get_files_from_current_directory.js ├── rust ├── hello │ └── gkanishk_helloworld.rs ├── prime │ └── Henning-K_prime.rs ├── maths │ ├── ngweihow_areacircle.rs │ └── ngweihow_pythagoras.rs └── fibonacci │ └── Henning-K_fibonacci.rs ├── .github ├── FUNDING.yml ├── PULL_REQUEST_TEMPLATE.md └── ISSUE_TEMPLATE │ ├── feature-request.md │ └── bug_report.md ├── brainfuck └── hello │ └── ScholliYT_hello_world.bf ├── clisp └── fibonacci │ ├── moore3071_fibonacci.lisp │ └── moore3071_binet_fibonacci.lisp ├── cplusplus ├── hello │ └── kannagikazuko_hello.cc ├── RanveerSinghKhattra_generate_beep.cpp ├── Include-Poetry_swap_two_integers.cpp ├── even │ └── shweta0310_even_odd_checker.cpp ├── anagram │ └── s-ankur_anagrams.cpp ├── caesar │ └── s-ankur_caesar.cpp ├── reverse │ └── shweta0310_string_reverse.cpp ├── NeoAnoman_one_line_swap.cpp ├── sorting │ └── gafeol_selection_sort.cpp ├── ZombieChibiXD_Palindrome.cpp ├── unique │ ├── remove_duplicates.cpp │ ├── jagwiredev_remove_duplicates.cpp │ ├── ahnafhf21_remove_duplicate_elements.cpp │ └── subhamX_unique_array.cpp ├── balgopal123_factorial.cpp └── prime │ └── radensaleh_T-Primes.cpp ├── groovy ├── piotrgajow_multiply_ints.groovy └── valleys │ └── piotrgajow_counting_valleys.groovy ├── scala ├── anagram │ └── saucam_Anagram.scala └── even │ └── ivanightingale_onlyEvenDigits.scala ├── powershell ├── hello │ └── yyoel_hello.ps1 ├── unique │ └── Kmek_UniqueArray.ps1 ├── Astronaut │ └── rpstester_ListOfPeopleInSpace.ps1 ├── turbosnute_strongpassword.ps1 └── jantari_download_and_install_7-zip.ps1 ├── ruby ├── reverse │ └── animanmaster_string_reverse.rb ├── prime │ └── onlyasmalllizard_is_prime.rb ├── approximate_pi │ └── shaunak-gupta_approximate_pi_basel.rb ├── fibonacci │ ├── animanmaster_fibonacci.rb │ └── animanmaster_fibonacci_iterative.rb └── approximate_e │ └── shaunak-gupta_approximate_e_stochastic.rb ├── java ├── ernesoglu_Factorial.java ├── BenjaminUrquhart_SumDigits.java ├── sgirabin_Max2Digit.java ├── ernesoglu_DigitsSum.java ├── fibonacci │ └── ernesoglu_Fibonacci.java ├── ZombieChibiXD_Palindrome.java ├── ernesoglu_Ackermann.java ├── ernesoglu_Vowels.java ├── sorting │ └── Akash-Sareen_SortExample.java ├── PRITI1999_sum_of_natural_numbers.java ├── janeliutw_StreamExample.java ├── bshehata_getMax.java ├── approximate_pi │ └── edgriebel_WallisPi.java └── mrinal-pandey_height_binary_tree.java ├── scheme └── fibonacci │ └── lbarros00_fib.scm ├── swift └── anagram │ └── nmasnadithya_anagramChecker.swift ├── _assemble ├── run.js └── check.coffee ├── dart └── hello │ └── gkanishk_hello.dart ├── awk └── pbootly_temperature_convertor.awk ├── csharp └── reverse │ └── spikejap_stringreversal.cs ├── package.json ├── README.md ├── CONTRIBUTING.md ├── .gitignore └── CONTRIBUTORS.md /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-midnight -------------------------------------------------------------------------------- /python/Priultimus_that.py: -------------------------------------------------------------------------------- 1 | import this 2 | -------------------------------------------------------------------------------- /perl/mattchuranu_list-files.p6: -------------------------------------------------------------------------------- 1 | shell 'ls' 2 | -------------------------------------------------------------------------------- /php/AmosGarner_printBinary.php: -------------------------------------------------------------------------------- 1 | a; 2 | -------------------------------------------------------------------------------- /javascript/rpxs_add.js: -------------------------------------------------------------------------------- 1 | const add = (a, b) => a + b; 2 | -------------------------------------------------------------------------------- /perl/prime/Ojaswy_prime.pl: -------------------------------------------------------------------------------- 1 | /^.?$|^(..+?)\1+$/ 2 | 3 | -------------------------------------------------------------------------------- /python/hello/Kmek_hello.py: -------------------------------------------------------------------------------- 1 | print("Hello World!!!") 2 | -------------------------------------------------------------------------------- /bash/hello/Kmek_hello.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "hello world" 3 | -------------------------------------------------------------------------------- /c/hello/dchenmei_hello.c: -------------------------------------------------------------------------------- 1 | main(){puts("Hello, World!");} 2 | -------------------------------------------------------------------------------- /clojure/hello/effi-t_hello-world.clj: -------------------------------------------------------------------------------- 1 | (println "Hello, World!") -------------------------------------------------------------------------------- /coffeescript/wzhouwzhou_add.coffee: -------------------------------------------------------------------------------- 1 | add = (a, b) -> a + b 2 | -------------------------------------------------------------------------------- /javascript/dorman99_split.js: -------------------------------------------------------------------------------- 1 | const split = (str)=> str.split('') -------------------------------------------------------------------------------- /javascript/even/jackkav_isEven.js: -------------------------------------------------------------------------------- 1 | const isEven = n => !(n & 1) -------------------------------------------------------------------------------- /javascript/even/jackkav_isOdd.js: -------------------------------------------------------------------------------- 1 | const isOdd = n => !!(n & 1) -------------------------------------------------------------------------------- /javascript/toluwalope19_spread.js: -------------------------------------------------------------------------------- 1 | const arr1 = [...arr]; 2 | -------------------------------------------------------------------------------- /perl/hello/mattchuranu_hello-world.p6: -------------------------------------------------------------------------------- 1 | say "Hello World"; 2 | -------------------------------------------------------------------------------- /go/wzhouwzhou_add.go: -------------------------------------------------------------------------------- 1 | func add(a, b int) int { return a + b } 2 | -------------------------------------------------------------------------------- /javascript/rpxs_subtract.js: -------------------------------------------------------------------------------- 1 | const subtract = (a, b) => a - b 2 | -------------------------------------------------------------------------------- /javascript/sowhatdoido_isTruthy.js: -------------------------------------------------------------------------------- 1 | export default (a) => (!!a); 2 | -------------------------------------------------------------------------------- /javascript/vetlix_empty_array.js: -------------------------------------------------------------------------------- 1 | const empty = arr => arr.length = 0; -------------------------------------------------------------------------------- /ocaml/hello/AnkitaBIT_hello.ml: -------------------------------------------------------------------------------- 1 | print_endline "Hello, world!" ;; 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - '10' 4 | - '8' 5 | -------------------------------------------------------------------------------- /coffeescript/wzhouwzhou_subtract.coffee: -------------------------------------------------------------------------------- 1 | subtract = (a, b) -> +a - +b 2 | -------------------------------------------------------------------------------- /haskell/reverse/joaoportela_reverse.hs: -------------------------------------------------------------------------------- 1 | reverseFunc = foldl (flip (:)) [] -------------------------------------------------------------------------------- /perl/mattchuranu_log2n.p6: -------------------------------------------------------------------------------- 1 | sub MAIN($n) { (log($n) / log(2)).say } 2 | -------------------------------------------------------------------------------- /python/reverse/dhruvs009_strrev.py: -------------------------------------------------------------------------------- 1 | def reverse(s): return s[-1::-1] 2 | -------------------------------------------------------------------------------- /javascript/reverse/saxenanamay_reverse_array.js: -------------------------------------------------------------------------------- 1 | reverse=a=>a.map(a.pop,[...a]) -------------------------------------------------------------------------------- /javascript/vetlix_deepflat_array.js: -------------------------------------------------------------------------------- 1 | const deepFlat = arr => arr.flat(Infinity); -------------------------------------------------------------------------------- /php/AmosGarner_printRandomNumbers.php: -------------------------------------------------------------------------------- 1 | zipWith(+)(0:a)$a++[0])[1] 2 | -------------------------------------------------------------------------------- /javascript/bhirmbani_copy_object.js: -------------------------------------------------------------------------------- 1 | const copyObject = object => ({...object}); 2 | -------------------------------------------------------------------------------- /javascript/devshawn_take.js: -------------------------------------------------------------------------------- 1 | const take = (number, array) => array.slice(0, number); -------------------------------------------------------------------------------- /javascript/romellogoodman_copy_array.js: -------------------------------------------------------------------------------- 1 | const copy = array => array.slice(0); 2 | -------------------------------------------------------------------------------- /pascal/hello/kannagikazuko_hello-world.pas: -------------------------------------------------------------------------------- 1 | begin writeln('Hello, world!') end. 2 | -------------------------------------------------------------------------------- /python/amanagarwal-sopho_sum_of_digits.py: -------------------------------------------------------------------------------- 1 | f = lambda s: sum([int(p) for p in s]) -------------------------------------------------------------------------------- /bash/Mohammed Nisham_ip.sh: -------------------------------------------------------------------------------- 1 | ifconfig | grep inet | grep broadcast | cut -f2 -d' ' 2 | -------------------------------------------------------------------------------- /bash/icedream_ip_awk.sh: -------------------------------------------------------------------------------- 1 | ifconfig | grep inet | grep broadcast | awk '{print $2}' 2 | -------------------------------------------------------------------------------- /javascript/bgail_get_min.js: -------------------------------------------------------------------------------- 1 | const getMin = (arr) => arr.reduce( (x,y) => x a - b ); 2 | -------------------------------------------------------------------------------- /javascript/unique/ananta_unique_array.js: -------------------------------------------------------------------------------- 1 | const uniqueItems = arr => [...new Set(arr)]; 2 | -------------------------------------------------------------------------------- /perl/mattchuranu_gcd.p6: -------------------------------------------------------------------------------- 1 | sub MAIN($i, $j) { { $j == 0 ?? say $i !! MAIN($j, $i%$j)}($j) } 2 | -------------------------------------------------------------------------------- /php/AmosGarner_getMax.php: -------------------------------------------------------------------------------- 1 | = $b ) ? $a : $b;} 2 | -------------------------------------------------------------------------------- /python/mspatel927_Mirror_List.py: -------------------------------------------------------------------------------- 1 | def mirrorList(list): 2 | return list[::-1] 3 | 4 | -------------------------------------------------------------------------------- /vim/igemnace_multiply_ints.vim: -------------------------------------------------------------------------------- 1 | let Multiply = {a, b -> len(repeat(repeat('i', a), b))} 2 | -------------------------------------------------------------------------------- /javascript/Priultimus_sum_of_ints.js: -------------------------------------------------------------------------------- 1 | const sum = (x, y) => y ? sum(x ^ y, (x & y) << 1) : x; 2 | -------------------------------------------------------------------------------- /javascript/fibonacci/matankb_fibonacci.js: -------------------------------------------------------------------------------- 1 | const fib = n => n >= 2 ? fib(n - 1) + fib(n - 2) : n; -------------------------------------------------------------------------------- /javascript/hello/vamisola_hello.js: -------------------------------------------------------------------------------- 1 | console.log("Hello there from the land down under! "); 2 | -------------------------------------------------------------------------------- /javascript/matankb_sum_of_range.js: -------------------------------------------------------------------------------- 1 | const sumOfRange = (m , n) => ((-m * m) + (n * n) + m + n) / 2; -------------------------------------------------------------------------------- /nodejs/hello/kannagikazuko_hello_world.js: -------------------------------------------------------------------------------- 1 | void(process.stdout.write('Hello, world!\r\n\0')); 2 | -------------------------------------------------------------------------------- /python/Kartikaggarwal98_create_dict_from_two_lists.py: -------------------------------------------------------------------------------- 1 | a=[1,2,3]; b=[3,2,1]; print(dict(zip(a,b))) -------------------------------------------------------------------------------- /python/Kartikaggarwal98_display_calendar.py: -------------------------------------------------------------------------------- 1 | import calendar; print(calendar.month(2018,10)); 2 | -------------------------------------------------------------------------------- /python/anagram/bsanders_anagram.py: -------------------------------------------------------------------------------- 1 | s = 'anagram' 2 | t = 'gramana' 3 | sorted(s) == sorted(t) 4 | -------------------------------------------------------------------------------- /python/earvingemenez_format_currency.py: -------------------------------------------------------------------------------- 1 | amount = '{:20,.2f}'.format(number); print(amount) 2 | -------------------------------------------------------------------------------- /python/even/ThaLeprechaun_list_of_odd_numbers.py: -------------------------------------------------------------------------------- 1 | print([i for i in range(20) if i % 2 != 0]) 2 | -------------------------------------------------------------------------------- /python/hello/jaakofalltrade_helloworld.py: -------------------------------------------------------------------------------- 1 | print("Hello World, Kumusta Mundo, Hola Mundo!"); 2 | -------------------------------------------------------------------------------- /python/mspatel927_Random_Card_Draw.py: -------------------------------------------------------------------------------- 1 | def mean(list): 2 | return sum(list)/len(list) 3 | 4 | -------------------------------------------------------------------------------- /rust/hello/gkanishk_helloworld.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 3 | println!("Hello World!"); 4 | } 5 | -------------------------------------------------------------------------------- /bash/Mohammed Nisham_generatePassword.sh: -------------------------------------------------------------------------------- 1 | head -c 100 /dev/urandom | base64 | head -c 12 | pbcopy - 2 | -------------------------------------------------------------------------------- /javascript/RanveerSinghKhattra_get_user_input.js: -------------------------------------------------------------------------------- 1 | var inputValue = prompt("Please type something."); 2 | -------------------------------------------------------------------------------- /javascript/devshawn_find_key.js: -------------------------------------------------------------------------------- 1 | const findKey = (fn, obj) => Object.keys(obj).find(key => fn(obj[key])); -------------------------------------------------------------------------------- /javascript/devshawn_random.js: -------------------------------------------------------------------------------- 1 | const random = (array) => array[Math.floor(Math.random() * array.length)]; -------------------------------------------------------------------------------- /javascript/romellogoodman_html_strip.js: -------------------------------------------------------------------------------- 1 | const stripHTML = html => html.replace(/<[^>]+>/gi, ''); 2 | -------------------------------------------------------------------------------- /javascript/shuffle_array.js: -------------------------------------------------------------------------------- 1 | const shuffle = arr => arr.slice().sort(() => Math.random() - 0.5); 2 | -------------------------------------------------------------------------------- /javascript/wzhouwzhou_multiply_ints.js: -------------------------------------------------------------------------------- 1 | const multiply = (a, b) => 'i'.repeat(a).repeat(b).length; 2 | -------------------------------------------------------------------------------- /python/AghastComet_fahrenheit_to_celsius.py: -------------------------------------------------------------------------------- 1 | C = (int(input('Temperature in fahrenheit: '))-32)*5/9 2 | -------------------------------------------------------------------------------- /python/mirandars_par-perfect-squares.py: -------------------------------------------------------------------------------- 1 | [elemento**2 for elemento in range(11) if elemento%2==0] 2 | -------------------------------------------------------------------------------- /bash/pbootly_fizzbuzz.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | seq 100 | awk '$0=NR%15?NR%5?NR%3?$0:"fizz":"buzz":"fizzbuzz"' 3 | -------------------------------------------------------------------------------- /javascript/devshawn_drop.js: -------------------------------------------------------------------------------- 1 | const drop = (number, array) => array.slice(Math.max(number, 0), Infinity); 2 | -------------------------------------------------------------------------------- /nodejs/wzhouwzhou_delay.js: -------------------------------------------------------------------------------- 1 | (t = 1000) && Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, t) 2 | -------------------------------------------------------------------------------- /python/cricketer94_transpose.py: -------------------------------------------------------------------------------- 1 | trans_mat = lambda x : zip(*x) 2 | print(trans_mat([[1,2,3],[1,2,3]])) 3 | -------------------------------------------------------------------------------- /python/kblicharski_merge_dictionaries.py: -------------------------------------------------------------------------------- 1 | print({**{'a': 1, 'b': 2, 'c': 3}, **{'e': 5, 'f': 6, 'd': 4}}) 2 | -------------------------------------------------------------------------------- /python/melissachen2000_derivative.py: -------------------------------------------------------------------------------- 1 | print( float("%.2f" % ((f(v + .000000000001) - f(v))/.000000000001))) -------------------------------------------------------------------------------- /bash/dinhnv_colors.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | for i in {0..255}; do printf "\x1b[38;5;${i}mcolour${i}\x1b[0m\t"; done 3 | -------------------------------------------------------------------------------- /haskell/bbyalcinkaya_quine.hs: -------------------------------------------------------------------------------- 1 | main = putStrLn $ (\x -> x ++ show x)"main = putStrLn $ (\\x -> x ++ show x)" 2 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/javascript/isPrime.js: -------------------------------------------------------------------------------- 1 | const isPrime = i => {for (d=2;d1} 2 | -------------------------------------------------------------------------------- /javascript/dhaveed_swap_variables.js: -------------------------------------------------------------------------------- 1 | function swap(a,b){return [a,b] = [b,a];} //so for example swap(3,2) = [2,3]. -------------------------------------------------------------------------------- /javascript/reverse/romellogoodman_reverse_sentence.js: -------------------------------------------------------------------------------- 1 | const reverse = str.split(' ').reverse().join(' '); 2 | -------------------------------------------------------------------------------- /javascript/reverse/romellogoodman_reverse_string.js: -------------------------------------------------------------------------------- 1 | const reverse = str => str.split('').reverse().join(''); 2 | -------------------------------------------------------------------------------- /javascript/tiffany-jao_isTriangle.js: -------------------------------------------------------------------------------- 1 | const isTriangle = (a, b, c) => (a + b > c) && (a + c > b) && ( b + c > a); -------------------------------------------------------------------------------- /php/even/ericksuryadinata_even_odd.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /python/fibonacci/MaheshSuranga_fibonanci.py: -------------------------------------------------------------------------------- 1 | fib = lambda n:reduce(lambda x,n:[x[1],x[0]+x[1]], range(n),[0,1])[0] -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | custom: https://paypal.me/wzhouwzhou 4 | -------------------------------------------------------------------------------- /bash/suksit_remove-unused-docker-images.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker rmi $(docker images -q --filter dangling=true) 3 | -------------------------------------------------------------------------------- /brainfuck/hello/ScholliYT_hello_world.bf: -------------------------------------------------------------------------------- 1 | +[>>>->-[>->----<<<]>>]>.---.>+..+++.>>.<.>>---.<<<.+++.------.<-.>>+. 2 | -------------------------------------------------------------------------------- /javascript/unique/niralpokal_getUniqueArrayValues.js: -------------------------------------------------------------------------------- 1 | const getUniqueArrayValues = (arr) => Array.from(new Set(arr)); -------------------------------------------------------------------------------- /perl/hello/Cyclenerd_hello-world.pl: -------------------------------------------------------------------------------- 1 | scalar getpwuid($<) ? print "Hello ". scalar getpwuid($<) ."\n" : "Hello World\n"; -------------------------------------------------------------------------------- /php/fibonacci/hugonun_fibonacci.php: -------------------------------------------------------------------------------- 1 | s.length && `${reverse(s.slice(1))}${s[0]}` || s; 2 | -------------------------------------------------------------------------------- /javascript/sowhatdoido_get_mean.js: -------------------------------------------------------------------------------- 1 | export default (numbers) => (numbers.reduce((a, b) => (a + b),0)/numbers.length); 2 | -------------------------------------------------------------------------------- /nodejs/tacticaltechjay_coinFlip.js: -------------------------------------------------------------------------------- 1 | Math.floor(Math.random() * 2) === 1 ? console.log('Heads!') : console.log('Tails!') 2 | -------------------------------------------------------------------------------- /python/JoaoRacedo_Matrix_Transpose.py: -------------------------------------------------------------------------------- 1 | a=[[1,2,3],[4,5,6],[7,8,9]];inverted_a = [list(i) for i in zip(*a)];print(inverted_a) -------------------------------------------------------------------------------- /python/OpticGenius_list_files.py: -------------------------------------------------------------------------------- 1 | import os; print('\n'.join(file for file in os.listdir('.') if os.path.isfile(file))) 2 | -------------------------------------------------------------------------------- /python/ShaneCreedon_dict_of_squares.py: -------------------------------------------------------------------------------- 1 | print (dict(zip(list(range(1, 15)), list(map(lambda x: x*x, range(1, 15)))))) 2 | -------------------------------------------------------------------------------- /python/factorial/factorial_n6wbi6.py: -------------------------------------------------------------------------------- 1 | fact = lambda x: 1 if x == 0 else x * fact(x-1) 2 | #testing it 3 | print(fact(25)) -------------------------------------------------------------------------------- /clisp/fibonacci/moore3071_fibonacci.lisp: -------------------------------------------------------------------------------- 1 | (defun fibonacci (n) (if (<= n 2) 1 (+ (fibonacci (- n 1)) (fibonacci (- n 2))))) 2 | -------------------------------------------------------------------------------- /cplusplus/hello/kannagikazuko_hello.cc: -------------------------------------------------------------------------------- 1 | #include 2 | int main() { std::cout << "Hello, world!" << std::endl; } 3 | -------------------------------------------------------------------------------- /javascript/Kaljuk_get_min2.js: -------------------------------------------------------------------------------- 1 | // Sorter version of get_min.js using Math module 2 | const getMin = arr => Math.min(...arr); 3 | -------------------------------------------------------------------------------- /javascript/Xander1233_collatzConjecture.js: -------------------------------------------------------------------------------- 1 | const collatz = x => x <= 1 ? x : collatz((x % 2) === 0 ? x / 2 : x * 3 + 1); 2 | -------------------------------------------------------------------------------- /javascript/unique/jackkav_two_strings.js: -------------------------------------------------------------------------------- 1 | const twoStrings = (s1, s2) => s1.split``.find(x => s2.includes(x)) ? "YES" : "NO" 2 | -------------------------------------------------------------------------------- /php/adeojoemmanuel_checkSession.php: -------------------------------------------------------------------------------- 1 | is_logged_in() ? $user->get('first_name') : 'Guest'); -------------------------------------------------------------------------------- /bash/devAmoghS_directories_tree_view.sh: -------------------------------------------------------------------------------- 1 | ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/' 2 | -------------------------------------------------------------------------------- /bash/hello/Sourabh950_hello.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo Hello World # This is how we add comment in the bash file. 4 | 5 | -------------------------------------------------------------------------------- /cplusplus/RanveerSinghKhattra_generate_beep.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main(){ 3 | std::cout<<"\a"; 4 | return 0; 5 | } 6 | -------------------------------------------------------------------------------- /javascript/Kaljuk_max_difference_math.js: -------------------------------------------------------------------------------- 1 | // Using Math module 2 | const difference = arr => Math.max(...arr) - Math.min(...arr); 3 | -------------------------------------------------------------------------------- /javascript/bramleyjl_max_difference.js: -------------------------------------------------------------------------------- 1 | var difference = a => a.sort((x, y) => x - y)[(a.length -1)] - a.sort((x, y) => x - y)[0]; 2 | -------------------------------------------------------------------------------- /nodejs/NguyenDa18_new_server.js: -------------------------------------------------------------------------------- 1 | require('http').createServer((req, res) => res.end('Server started')).listen(process.env.PORT); 2 | -------------------------------------------------------------------------------- /python/devarakondapranav_multiply_without_arithmeticAndBinary.py: -------------------------------------------------------------------------------- 1 | def mul(a, b): return len([True for i in range(a) for j in range(b)]) -------------------------------------------------------------------------------- /python/fibonacci/moore3071_binet_fibonacci.py: -------------------------------------------------------------------------------- 1 | f = lambda n: int((((1+math.sqrt(5))/2)**n - ((1-math.sqrt(5))/2)**n)/math.sqrt(5)) 2 | -------------------------------------------------------------------------------- /python/unique/RaInta_unique_array.py: -------------------------------------------------------------------------------- 1 | list1 = [1,10,7,1,4] 2 | 3 | [x for idx, x in enumerate(list1) if x not in list1[:idx]] 4 | -------------------------------------------------------------------------------- /bash/antoooks_print_top_10_user_agents_from_access_log.sh: -------------------------------------------------------------------------------- 1 | awk -F '"' '{print $6}' access.log | sort -nr | uniq -c | sort -nr | head -n10 -------------------------------------------------------------------------------- /groovy/piotrgajow_multiply_ints.groovy: -------------------------------------------------------------------------------- 1 | Closure multiply = { int a, int b -> GroovyCollections.combinations((1..a), (1..b)).size() } 2 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/javascript/memoize.js: -------------------------------------------------------------------------------- 1 | const memoize = f =>{var c={};return x => {if (x in c)return c[x];return (c[x]=f(x))}} 2 | -------------------------------------------------------------------------------- /javascript/ZombieChibiXD_Palindrome.js: -------------------------------------------------------------------------------- 1 | const palindrome = (text) => text.toLowerCase() == text.toLowerCase().split("").reverse().join(""); -------------------------------------------------------------------------------- /javascript/fibonacci/audrius59_fibonacci2.js: -------------------------------------------------------------------------------- 1 | function fibo(num) { 2 | return num < 2 ? num : fibo(num - 1) + fibo(num - 2); 3 | } 4 | -------------------------------------------------------------------------------- /javascript/reverse/rrrepsaj_reverse_string_with_reduce.js: -------------------------------------------------------------------------------- 1 | const reverse = str => str.split("").reduceRight((acc, curr) => acc + curr); 2 | -------------------------------------------------------------------------------- /python/approximate_e/ServinDC_approximate_e.py: -------------------------------------------------------------------------------- 1 | print('\ne ~',sum([1/((1-1./n)**n) for n in [int(input('Big value for limit: ')) ]]) ) 2 | -------------------------------------------------------------------------------- /python/earvingemenez_get_age.py: -------------------------------------------------------------------------------- 1 | from datetime import date, timedelta;age = (date.today() - birth_date) // timedelta(days=365.2425) 2 | -------------------------------------------------------------------------------- /bash/OpticGenius_longest.sh: -------------------------------------------------------------------------------- 1 | find . -type f | xargs ls -lS | head -1 | awk '{print "LONGEST ONE LINER\ncharacters: " $5 "\nfile: " $NF}' 2 | -------------------------------------------------------------------------------- /c/hello/n6wbi6_hello_world.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | 5 | printf("Hello, world!"); 6 | return 0; 7 | 8 | } 9 | -------------------------------------------------------------------------------- /haskell/sorting/george1410_quicksort.hs: -------------------------------------------------------------------------------- 1 | qsort [] = [] 2 | qsort (x:xs) = qsort [y | y <- xs, y < x] ++ [x] ++ qsort [y | y <- xs, y >= x] 3 | -------------------------------------------------------------------------------- /javascript/sowhatdoido_withoutValue.js: -------------------------------------------------------------------------------- 1 | export default (a, b) => ( b = a.indexOf(b), b == -1) ? a : a.slice(0, b).concat(a.slice(b + 1)); 2 | -------------------------------------------------------------------------------- /perl/mattchuranu_ask-for-filename-until-given-one-that-doesnt-exist.p6: -------------------------------------------------------------------------------- 1 | split(" ", (if my $f = "." { do $f = get while $f.IO.e }))[*-1].say 2 | -------------------------------------------------------------------------------- /python/andrus14_leap_year.py: -------------------------------------------------------------------------------- 1 | year = 2000 2 | print("leap year" if year % 4 == 0 and year % 100 != 0 or year % 400 == 0 else "common year") 3 | -------------------------------------------------------------------------------- /python/approximate_pi/AghastComet_approximate_pi.py: -------------------------------------------------------------------------------- 1 | print(4*sum([1/(2*i-1) * (-1)**(i-1) for i in range(1,int(input('Iterations: ')))])) 2 | -------------------------------------------------------------------------------- /python/golden_ratio/Ribodou_phi.py: -------------------------------------------------------------------------------- 1 | phi = lambda n, val : 1+1/phi(n-1, val) if n >0 else 1 2 | print(phi(int(input("enter a value")), 0)) 3 | -------------------------------------------------------------------------------- /javascript/jackkav_hex2rgb.js: -------------------------------------------------------------------------------- 1 | const hex2rgb = hex => [(parseInt(hex, 16) >> 16) & 0xff, (parseInt(hex, 16) >> 8) & 0xff, parseInt(hex, 16) & 0xff] -------------------------------------------------------------------------------- /javascript/johnfoderaro_get_random_key.js: -------------------------------------------------------------------------------- 1 | const getRandomKey = (obj) => Object.keys(obj)[Math.floor(Math.random() * Object.keys(obj).length)]; 2 | -------------------------------------------------------------------------------- /perl/remove_duplicates.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | my @array = (1,10,7,1,4); 4 | my @unique = keys {map {$_ => 1} @array}; 5 | print @unique; 6 | -------------------------------------------------------------------------------- /php/adeojoemmanuel_getmin.php: -------------------------------------------------------------------------------- 1 | $small ? true : false); // returns true -------------------------------------------------------------------------------- /python/Kartikaggarwal98_frequency_elements.py: -------------------------------------------------------------------------------- 1 | import numpy as np; a=[1,1,2,2,2,0,5,3,3,3,3]; print(np.unique(np.array(a),return_counts=True)) 2 | -------------------------------------------------------------------------------- /python/earvingemenez_generate_password.py: -------------------------------------------------------------------------------- 1 | import secrets, string; "".join(secrets.choice(string.ascii_letters + string.digits) for i in range(16)) -------------------------------------------------------------------------------- /python/kennedy_squaresum_diff_sumsquare.py: -------------------------------------------------------------------------------- 1 | sdiffs = lambda x:pow(sum(range(x+1)),2)-sum([i*i for i in range(1,x+1)]) #print(sdiffs(100))->25164150 -------------------------------------------------------------------------------- /python/sorting/Nitish18_list_key_based_sorting.py: -------------------------------------------------------------------------------- 1 | list1 = [1, 5, 2, 9, 10] 2 | sorted_list = sorted(list1, reverse=True) 3 | print(sorted_list) 4 | -------------------------------------------------------------------------------- /clisp/fibonacci/moore3071_binet_fibonacci.lisp: -------------------------------------------------------------------------------- 1 | (defun fibonacci (n) (nth-value 0 (floor (/ (- (/ (+ 1 (sqrt 5)) 2) (/ (- 1 (sqrt 5)) 2)) (sqrt 5))))) 2 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/c/hello/juricav_helloWorld.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | printf("Hello, World!"); 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/javascript/golden_ratio.js: -------------------------------------------------------------------------------- 1 | (() => { ϕ = 1; i = 1000; do {ϕ = 1 + 1/ϕ} while (i--); console.log("Golden Ration: " + ϕ)})(); 2 | -------------------------------------------------------------------------------- /python/kblicharski_create_directories.py: -------------------------------------------------------------------------------- 1 | import os; num = int(input("How many directories: ")); [os.makedirs(f'directory{i}') for i in range(num)] 2 | -------------------------------------------------------------------------------- /bash/Andrus_thumbnail_from_pdf_page.sh: -------------------------------------------------------------------------------- 1 | # x80 is height of the thumbnail and [0] is the first page of pdf 2 | convert -thumbnail x80 file.pdf[0] thumbnail.png -------------------------------------------------------------------------------- /honorary-one-line-wonders/python/convert_to_csv.py: -------------------------------------------------------------------------------- 1 | import csv; f=open(outfile, 'w'); w=csv.DictWriter(f, data.keys()); w.writeheader(); w.writerow(data) 2 | -------------------------------------------------------------------------------- /javascript/dhaveed_pad_zeros.js: -------------------------------------------------------------------------------- 1 | function pad(v){return ('0'+v).substr(-2);} //so for example pad(8) = 08. (Only works for single and double digit ints.) 2 | -------------------------------------------------------------------------------- /javascript/jackkav_get_frequency.js: -------------------------------------------------------------------------------- 1 | const getFrequency = (array, key) => array.reduce((totals, p) => ({...totals, [p[key]]: (totals[p[key]] || 0) + 1}), {}) -------------------------------------------------------------------------------- /scala/anagram/saucam_Anagram.scala: -------------------------------------------------------------------------------- 1 | object Anagram { 2 | def isAnagram(s: String, t: String): Boolean = s.groupBy(identity) == t.groupBy(identity) 3 | } 4 | -------------------------------------------------------------------------------- /javascript/capJavert_is-touch-device.js: -------------------------------------------------------------------------------- 1 | const isTouchDevice = () => !!('ontouchstart' in window || (window.DocumentTouch && document instanceof DocumentTouch)) 2 | -------------------------------------------------------------------------------- /javascript/jjroush_map_filter_reduce.js: -------------------------------------------------------------------------------- 1 | const map_filter_reduce = (array) => array.map(x => x * 2).filter((x,i) => i % 2 === 0 ).reduce((acc,cur) => acc + cur) 2 | -------------------------------------------------------------------------------- /python/blitzh0t_vowels.py: -------------------------------------------------------------------------------- 1 | from collections import Counter 2 | c = Counter(str(input('enter a word: ')).lower()) 3 | print({v: c[v] for v in 'aeiou' if v in c}) 4 | -------------------------------------------------------------------------------- /python/kennedy_emotions.py: -------------------------------------------------------------------------------- 1 | import itertools; import functools; functools.reduce(lambda _, x: print(x, end=''), itertools.cycle('😀😁😂😃😄😅😆😇😈😉😊😋😌😍😎😏')) -------------------------------------------------------------------------------- /python/sorting/blicharski_print_sorted_environment_variables.py: -------------------------------------------------------------------------------- 1 | import os; [print(f'{var}={val}') for var, val in dict(sorted(os.environ.items())).items()] 2 | -------------------------------------------------------------------------------- /javascript/approximate_e/dinThea_approximate_e.js: -------------------------------------------------------------------------------- 1 | const approx_e = (iterations) => [...Array(iterations)].reduce((accum, _, k) => accum + 1/Math.pow(1 - 1/k, k), 0) 2 | -------------------------------------------------------------------------------- /perl/fibonacci/mattchuranu_fibonacci-sequence-to-the-nth-number.p6: -------------------------------------------------------------------------------- 1 | sub MAIN($i) { if my @n = [0, 1] { (^(Int($i) - 1))>>.&{@n.push(@n[$_] + @n[$_ + 1]).say} } } 2 | -------------------------------------------------------------------------------- /python/palindrome/melissachen2000_palindrome_checker.py: -------------------------------------------------------------------------------- 1 | print("is palindrome" if "".join(s.lower().split()) == "".join(s.lower().split())[::-1] else "is not palindrome") -------------------------------------------------------------------------------- /honorary-one-line-wonders/cplusplus/hello/juricav_helloWorld.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | std::cout << "Hello, World!"; 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /python/JoaoRacedo_Set_All_Subsets.py: -------------------------------------------------------------------------------- 1 | f = lambda x: [[y for j, y in enumerate(set(x)) if (i >> j) & 1] for i in range(2**len(set(x)))] # ;print(f([10,1,9,7,2])) example 2 | -------------------------------------------------------------------------------- /python/Kartikaggarwal98_iterate_multiple_lists.py: -------------------------------------------------------------------------------- 1 | from itertools import chain; 2 | x=[1,2]; y=['a','s','d']; z=['<','>','/']; 3 | for item in chain(x,y,z): print (item) 4 | -------------------------------------------------------------------------------- /python/moonblade_day.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | print(["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"][datetime.datetime.today().weekday()]) 3 | -------------------------------------------------------------------------------- /coffeescript/palindrome/wzhouwzhou_number-palindrome.coffee: -------------------------------------------------------------------------------- 1 | number = `123454321n` 2 | 3 | do main = -> console.log "#{number}" is "#{number}".split('').reverse().join '' 4 | -------------------------------------------------------------------------------- /javascript/mraymond_generate_list_of_numbers.js: -------------------------------------------------------------------------------- 1 | const generateListOfNumbers = (min, max) => Object.keys(Array.apply(null, Array(max-min+1))).map(val => parseInt(val)+min) 2 | -------------------------------------------------------------------------------- /javascript/sareeshv_escape_html.js: -------------------------------------------------------------------------------- 1 | const escapeHTML = (text) => text.replace(/[<>&"]/g, character => ({'<': '<', '>': '>','&': '&', '"': '"'})[character]); 2 | -------------------------------------------------------------------------------- /python/fibonacci/BrunoGomesCoelho_fibonacci.py: -------------------------------------------------------------------------------- 1 | fib = lambda n: n if n < 2 else fib(n-1) + fib(n-2) 2 | 3 | # Testing 4 | for i in range(13): 5 | print(fib(i), end=" ") 6 | -------------------------------------------------------------------------------- /python/golden_ratio/leaen_golden_ratio.py: -------------------------------------------------------------------------------- 1 | print('phi ~ %2f' % (lambda a: lambda v: a(a, v))(lambda s,n,x=1: s(s,n-1,1+1/x) if n>0 else x)(int(input('Enter large number: ')))) 2 | -------------------------------------------------------------------------------- /python/kblicharski_search_file_for_keyword.py: -------------------------------------------------------------------------------- 1 | word = input('Enter the word to match: '); [print(line) for line in open(input('Enter the file to search: ')) if word in line] 2 | -------------------------------------------------------------------------------- /python/mspatel927_Greater_Than.py: -------------------------------------------------------------------------------- 1 | # Returns a positive number if x is > y, 0 if they are equal, or a negative number if x is < y 2 | def greaterThan(x, y): 3 | return (x-y) 4 | -------------------------------------------------------------------------------- /r/prime/KKulma_find-prime-number.R: -------------------------------------------------------------------------------- 1 | is.prime <- function(n) n == 2L || all(n %% 2L:ceiling(sqrt(n)) != 0) 2 | 3 | # test 4 | test_vec <- 0:10 5 | sapply(test_vec, is.prime) 6 | -------------------------------------------------------------------------------- /javascript/niralpokal_isEmptyObject.js: -------------------------------------------------------------------------------- 1 | const isEmptyObject = (obj) => (Object.keys(obj).length === 0 && obj.constructor === Object && Object.getOwnPropertySymbols(obj).length === 0); -------------------------------------------------------------------------------- /python/blitzh0t_consonants.py: -------------------------------------------------------------------------------- 1 | from collections import Counter 2 | c = Counter(str(input('enter a word: ')).lower()) 3 | print({v: c[v] for v in 'bcdfghjklmnpqrstvwxyz' if v in c}) 4 | -------------------------------------------------------------------------------- /python/fibonacci/nikhilhassija_fibonacci-one-liner.py: -------------------------------------------------------------------------------- 1 | from functools import reduce; print(reduce(lambda x, y: (x[1], x[0] + x[1]), [None for i in range(int(input()))], (0, 1))[0]) 2 | -------------------------------------------------------------------------------- /haskell/palindrome/rsconsuegra_palindromic_product.hs: -------------------------------------------------------------------------------- 1 | tri=[(a,b,c)|a<-[1,2..100000],b<-[1,2..a], let c=a*b,show(a)++show(b)++show(c)==reverse(show(a))++reverse(show(b))++reverse(show(c))] -------------------------------------------------------------------------------- /javascript/vr1e_Kaljuk_get_max.js: -------------------------------------------------------------------------------- 1 | const getMax = arr => arr.reduce((m, n) => (m > n ? m : n)); 2 | // Get max via the built in Math module 3 | const getMax = arr => Math.max(...arr); 4 | -------------------------------------------------------------------------------- /python/kennedy_sum_multiples_of_a_b_less_than_x.py: -------------------------------------------------------------------------------- 1 | sumultiple = lambda a,b, x:int(sum(set([i for i in range(a, x, a)] + [i for i in range(b, x, b)]))) #print(sumultiple(3,5,1000)) 233168 -------------------------------------------------------------------------------- /c/RanveerSinghKhattra_creating_alert_sound.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main(){ 3 | printf("\a"); // Tip: Sometimes crashes if the system has no sound output device 4 | return 0; 5 | } 6 | -------------------------------------------------------------------------------- /python/fibonacci/brianhopper_fib_one-Liner.py: -------------------------------------------------------------------------------- 1 | fib = lambda n,a=1,b=1:[b,0][n>0] or fib(n-1,b,a+b) 2 | #returns the n-th fibonacci number, or 1 if n <= 0 3 | #just call fib(3), for instance 4 | -------------------------------------------------------------------------------- /python/predator21x_The-largest_number_that_can_be_represented_by_8_Byte.py: -------------------------------------------------------------------------------- 1 | print '\n'.join("%i Byte = %i Bit = largest number: %i" % (j, j*8, 256**j-1) for j in (1 << i for i in xrange(8))) 2 | -------------------------------------------------------------------------------- /javascript/hello/wzhouwzhou_hello-world-backwards.js: -------------------------------------------------------------------------------- 1 | Reflect.apply(console.log, {}, [(this.r = ((str = 'Hello, world!') => str.length === 0 ? str : `${this.r(str.substring(1))}${str[0]}`))()]); 2 | -------------------------------------------------------------------------------- /python/fibonacci/jamlamberti_fibonacci_seq.py: -------------------------------------------------------------------------------- 1 | print "\n".join(map(str,[(lambda f,n: f(f,n))(lambda g,a:a if a<2 else g(g,a-1)+g(g,a-2),n)for n in range(1,1+int(__import__('sys').argv[1]))])) 2 | -------------------------------------------------------------------------------- /python/priyankadalmia_factorial.py: -------------------------------------------------------------------------------- 1 | # A factorial one-line function (Python) 2 | fact = lambda n: [1,0][n>1] or fact(n-1)*n 3 | 4 | 5 | # test it 6 | print(fact(5)) 7 | 8 | # result - 120 9 | -------------------------------------------------------------------------------- /php/adeojoemmanuel_daysinamonth.php: -------------------------------------------------------------------------------- 1 | = l[0]]) 2 | print(sort([1,2,5,6,7,8])) 3 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/javascript/fibonnacci2.js: -------------------------------------------------------------------------------- 1 | ((n) => { (fib = (n) =>{ if(!fib.cache[n]){ fib.cache[n] = fib(n-1) + fib(n-2);} return fib.cache[n];}).cache = [0, 1, 1]; console.log(fib(n));})(50); 2 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/javascript/vetlix_array_map.js: -------------------------------------------------------------------------------- 1 | const map = (arr, cb) => { 2 | let i = arr.length, result = Array(i); 3 | while (i--) result[i] = cb(arr[i], i, arr); 4 | return result; 5 | }; -------------------------------------------------------------------------------- /javascript/romellogoodman_page_query_params.js: -------------------------------------------------------------------------------- 1 | const pageQueryParams = () => document.location.search.replace(/(^\?)/, '').split('&').reduce((o, n) => (n => o[n[0]] = n[1])(n.split('=')) && o, {}) || {}; 2 | -------------------------------------------------------------------------------- /php/ericksuryadinata_simple_-1+2-3+4.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /python/approximate_pi/yashagarwal1999_get_Approximate_Pi.py: -------------------------------------------------------------------------------- 1 | pi=lambda get_approx_pi:4 * sum(-float(k%4 - 2) / k for k in range(1, 2*val+1, 2)) 2 | val=int(input('Number of iterations')) 3 | print(pi(val)) 4 | -------------------------------------------------------------------------------- /python/bhavikb07_Factors.py: -------------------------------------------------------------------------------- 1 | from functools import reduce 2 | 3 | def factors(n): 4 | return list(set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))) 5 | 6 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | **Please describe your program and how to run it.** 2 | 3 | ...something... (replace this line) 4 | 5 | -------- 6 | **What Programming Language?** 7 | 8 | ...language... 9 | -------------------------------------------------------------------------------- /javascript/unique/wzhouwzhou_unique_values.js: -------------------------------------------------------------------------------- 1 | const values = [1, 2, 3, 4, 5, 1, 1, 1, 3]; 2 | 3 | const unique = [void(0)].map((e, i, arr) => new Set(values).forEach(v => arr.push(v)) || arr)[0].slice(1); 4 | -------------------------------------------------------------------------------- /python/JayWelborn_similar_strings.py: -------------------------------------------------------------------------------- 1 | # Compare two strings for similarity. Ratio closer to 1 = more similar 2 | from difflib import SequenceMatcher; similar = lambda a, b: SequenceMatcher(None, a, b).ratio() 3 | -------------------------------------------------------------------------------- /python/predator21x_decimal_conversion.py: -------------------------------------------------------------------------------- 1 | dec = 344 2 | 3 | print("The decimal value of",dec,"is:") 4 | print(bin(dec),"in binary.") 5 | print(oct(dec),"in octal.") 6 | print(hex(dec),"in hexadecimal.") 7 | -------------------------------------------------------------------------------- /ruby/reverse/animanmaster_string_reverse.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # Ruby Version 2.5.1 3 | 4 | reverse = ->(str) { str.empty? ? str : "#{str[-1]}#{reverse.(str.chop)}" } 5 | 6 | puts reverse.(ARGV[0].to_s) 7 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/javascript/sayoojtmc_timer.js: -------------------------------------------------------------------------------- 1 | let counter=5; 2 | var interval = setInterval(() => {console.log(counter);counter--;if(counter < 0 ){clearInterval(interval);console.log('Ding!');};}, 1000); 3 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/powershell/hello-old.ps1: -------------------------------------------------------------------------------- 1 | $command = Write-Host "Please enter your name..." ; $inputName = Read-Host ; while(!$inputName){ $inputName = Read-Host } echo "Hello World and Hello $inputName" 2 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/python/GenerateFibonacciSeq.py: -------------------------------------------------------------------------------- 1 | 2 | n=int(input()) 3 | 4 | a=1 5 | b=0 6 | while(n>0): 7 | print(a) 8 | temp=b 9 | b=a 10 | a=a+temp 11 | n=n-1 12 | 13 | -------------------------------------------------------------------------------- /python/ColeHoff7_hamming_distance.py: -------------------------------------------------------------------------------- 1 | # The hamming distance between two integers is the number of positions at which the corresponding bits are different. 2 | hamming = lambda x,y: format(x^y, "032b").count('1') 3 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/javascript/get_frequency.js: -------------------------------------------------------------------------------- 1 | const getFrequency=x=>{let p;x.sort();for(i=0,a=[],b=[];i({v,f:b[i]}))} 2 | -------------------------------------------------------------------------------- /r/Bassoon08_remove_NaN.r: -------------------------------------------------------------------------------- 1 | subset(x, !is.nan(x)) 2 | 3 | # given a vector x, e.g. 4 | # > x <- c(0, 1, NaN, 3) 5 | # > x 6 | # [1] 0 1 NaN 3 7 | # > x2 <- subset(x, !is.nan(x)) 8 | # > x2 9 | # [1] 0 1 3 10 | -------------------------------------------------------------------------------- /python/BrunoGomesCoelho_dot_product.py: -------------------------------------------------------------------------------- 1 | # To run, use use python3 dot_product.py 1,2,3 1,2,3 2 | import sys 3 | print(sum(x*y for x, y in zip(list(map(int, sys.argv[1].split(","))), list(map(int, sys.argv[2].split(",")))))) 4 | -------------------------------------------------------------------------------- /python/RaInta_e_to_pi.py: -------------------------------------------------------------------------------- 1 | from math import pi 2 | print('\ne^pi ~ ', sum([pow(pi, n)/(lambda a, b: a(a, b))(lambda a, b: b*a(a, b-1) if b > 0 else 1, n) for n in range(int(input('Enter reasonable sized number (>10): ')))]) ) 3 | -------------------------------------------------------------------------------- /python/melissachen2000_find_missing_number.py: -------------------------------------------------------------------------------- 1 | print(max(arr) + 1 if arr == list(range(min(arr), max(arr) + 1)) else [i for i in range(min(arr),max(arr) + 1) if i not in arr][0] if arr != range(min(arr),max(arr) + 1) else max) -------------------------------------------------------------------------------- /bash/ngweihow_shortest.sh: -------------------------------------------------------------------------------- 1 | # Author: ngweihow https://github.com/ngweihow 2 | find . -exec sh -c 'wc -m $0 2>/dev/null' {} \; | sort -n | grep -vwE "0 ." | head -1 | awk '{print "SHORTEST ONE LINER\ncharacters: "$1 "\nfile: "$2}' 3 | -------------------------------------------------------------------------------- /c/HarshitaArun_Swap.c: -------------------------------------------------------------------------------- 1 | #include 2 | void main() 3 | { 4 | int a,b; 5 | printf("enter a and b\n"); 6 | scanf("%d%d",&a,&b); 7 | a=(a+b)-(b=a); // one line code 8 | printf("a=%d and b=%d",a,b); 9 | } 10 | -------------------------------------------------------------------------------- /cplusplus/Include-Poetry_swap_two_integers.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main(){ 5 | int a, b; 6 | cin >> a >> b, a = (a+b) - (b=a), cout << a << " " << b << endl; 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /powershell/Astronaut/rpstester_ListOfPeopleInSpace.ps1: -------------------------------------------------------------------------------- 1 | (Invoke-WebRequest "http://api.open-notify.org/astros.json" | ConvertFrom-Json).people 2 | #note, I got the idea from PowerShell.com a while ago, but I cannot find it now. 3 | -------------------------------------------------------------------------------- /python/jamlamberti_pascals_triangle.py: -------------------------------------------------------------------------------- 1 | print "\n".join(["\t".join(["%d"%(lambda f,a,b:f(f,a)/(f(f,a-b)*f(f,b)))(lambda f,i: 1 if i <= 0 else i*f(f,i-1),n,r)for r in range(n+1)])for n in range(int(__import__('sys').argv[1]))]) 2 | -------------------------------------------------------------------------------- /bash/approximate_pi/pbootly_machin-pi-approximation.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Machin approximation of pi in bash with 100 terms 4 | echo $(scale=100; seq 1 2 200 | xargs -n1 -I{} echo '16*(1/5)^{}/{}-4*(1/239)^{}/{}' | paste -sd-+) | bc -l 5 | -------------------------------------------------------------------------------- /coffeescript/wzhouwzhou_isTruthy.coffee: -------------------------------------------------------------------------------- 1 | if typeof exports isnt 'undefined' and Reflect.defineProperty exports, '__esModule', value: true then exports.default = (o) -> !!o else exports = module.exports.default = module.exports = (o) -> !!o 2 | -------------------------------------------------------------------------------- /go/fibonacci/hurlenko_fibonacci.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | func main() { 8 | fmt.Println(fib(10)) 9 | } 10 | 11 | func fib(n float64) float64 {if n < 2 { return n } else {return fib(n-1) + fib(n-2)}} -------------------------------------------------------------------------------- /honorary-one-line-wonders/python/discord-bot.py: -------------------------------------------------------------------------------- 1 | exec("import discord\nfrom discord.ext import commands\nbot = commands.Bot(command_prefix='!')\n@bot.command()\nasync def hello(ctx):\n\tawait ctx.send('Hello World!')\nbot.run('token')") 2 | 3 | -------------------------------------------------------------------------------- /python/ColeHoff7_one-line-slot-machine.py: -------------------------------------------------------------------------------- 1 | import random,time;[print('[{}|{}|{}]'.format(random.choice('7♪♫♣♠♦♥◄☼☽'),random.choice('7♪♫♣♠♦♥◄☼☽'),random.choice('7♪♫♣♠♦♥◄☼☽'),t=time.sleep(.1)),end=('\r' if i != 19 else '\n')) for i in range(20)] 2 | -------------------------------------------------------------------------------- /python/OpticGenius_longest-one-liner.py: -------------------------------------------------------------------------------- 1 | import os; print("\n".join("{} {} size: {}".format(str(i), file, str(os.stat(file).st_size)) for i, file in enumerate(sorted(os.listdir('.'), key=lambda file: os.stat(file).st_size, reverse=True), start=1))) -------------------------------------------------------------------------------- /python/gsafcik_largest_sum_consecutive_nums_in_array.py: -------------------------------------------------------------------------------- 1 | import itertools; print(0, list(itertools.accumulate([1, 4, -2, 6, -5, 3])).index(max(list(itertools.accumulate([1, 4, -2, 6, -5, 3]))))) # not very pythonic in my opinion but it is a one-liner -------------------------------------------------------------------------------- /python/melissachen2000_fizzbuzz.py: -------------------------------------------------------------------------------- 1 | # To run, just use "python3 fizzbuzz.py " 2 | import sys 3 | print(*["fizzbuzz" if x % 15 == 0 else "fizz" if x % 3 == 0 else "buzz" if x % 5 == 0 else x for x in range(1, int(sys.argv[1])+1)], sep=" ") 4 | -------------------------------------------------------------------------------- /python/reverse/Cadarn_reverse_string.py: -------------------------------------------------------------------------------- 1 | reverse = lambda word: word[::-1] 2 | 3 | # Test case 4 | test_word = "Hello World!" 5 | print("Original word/phrase: {}".format(test_word)) 6 | print("Reversed word/phrase: {}".format(reverse(test_word))) 7 | -------------------------------------------------------------------------------- /python/unique/yashagarwal1999_unique_array.py: -------------------------------------------------------------------------------- 1 | def uni(arr): 2 | li=[] 3 | [li.append(i) for i in arr if not li.count(i)] 4 | return li 5 | 6 | list1 = [10, 20, 10, 30, 40, 40] 7 | print(getunique(list1)) 8 | 9 | 10 | -------------------------------------------------------------------------------- /coffeescript/hello/wzhouwzhou_hello-scramble.coffee: -------------------------------------------------------------------------------- 1 | console.log do main = (hello = 'Hello, world!'.split '') -> ([hello[i], hello[j]] = [hello[j], hello[i]] for i in [hello.length-1..1] when (j = Math.floor Math.random() * (i + 1))?) and hello.join '' 2 | -------------------------------------------------------------------------------- /cplusplus/even/shweta0310_even_odd_checker.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int n; 6 | cout<<"\nEnter no: ";cin>>n; 7 | (n%2==0)?cout<<"\nNo. is even\n":cout<<"\nNo. is odd\n"; 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /python/jamlamberti_pascals_triangle2.py: -------------------------------------------------------------------------------- 1 | print "\n".join(["\t".join(map(str,(lambda g,f,n: g(g,f,n))(lambda a,b,c:[1] if c==0 else b(a(a,b,c-1)),lambda a:[1]+[a[i-1]+a[i]for i in range(1,len(a))]+[1],n)))for n in range(int(__import__('sys').argv[1]))]) 2 | -------------------------------------------------------------------------------- /ruby/prime/onlyasmalllizard_is_prime.rb: -------------------------------------------------------------------------------- 1 | is_prime = ->(x) { return false if x < 2 2 | (2...x).none? { |factor| x % factor == 0} } 3 | 4 | # Test this by running `ruby is_prime.rb x` where x is the number to evaluate 5 | puts is_prime.call(ARGV[0].to_i) 6 | -------------------------------------------------------------------------------- /nodejs/hello/austinkregel_hello_world.js: -------------------------------------------------------------------------------- 1 | console.log((Buffer.from([ 0x53, 0x47, 0x56, 0x73, 0x62, 0x47, 0x38, 0x73, 0x49, 0x46, 0x64, 0x76, 0x63, 0x6d, 0x78, 0x6b, 0x49, 0x51, 0x3d, 0x3d ].map(bit => String.fromCharCode(bit)).join(''), 'base64')).toString()); 2 | -------------------------------------------------------------------------------- /haskell/fibonacci/dshimo_fibonacci.hs: -------------------------------------------------------------------------------- 1 | -- Fibonacci List Generator 2 | -- Written By: David Shi https://github.com/dshimo 3 | -- To generate a Fibonacci list of size 10 4 | -- Call take: take 10 fibs 5 | 6 | fibs = 0 : 1 : [ a + b | (a, b) <- zip fibs (tail fibs) ] 7 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/javascript/magnitude.js: -------------------------------------------------------------------------------- 1 | /** returns the magnitude between two n-length vectors */ 2 | 3 | const magnitude = (v1, v2) => Math.sqrt((a => { a.forEach((_, i) => a[i]=Math.exp(v1[i]-v2[i],2)); return a; })([...v1]).reduce((a, c) => a + c, 0)); 4 | -------------------------------------------------------------------------------- /java/ernesoglu_Factorial.java: -------------------------------------------------------------------------------- 1 | public class Factorial { 2 | private static int fact(int num) { return (num == 0 || num == 1) ? 1 : num * fact(num - 1); } 3 | 4 | public static void main(String[] args) { 5 | System.out.println(fact(5)); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /javascript/unique/jagwiredev_remove_duplicates.js: -------------------------------------------------------------------------------- 1 | // Define array for duplicates to be removed 2 | const array = [2, 5, 2, 6, 8]; 3 | // Create set from array (only adds non-duplicates) and print 4 | const unique = Array.from(new Set(array)); 5 | console.log(unique); 6 | -------------------------------------------------------------------------------- /php/adeojoemmanuel_twocondition.php: -------------------------------------------------------------------------------- 1 | 10 ? ($score < 80 ? 'behind' : 'above average') : ($score < 50 ? 'behind' : 'above average')); // returns 'You are behind' -------------------------------------------------------------------------------- /python/OpticGenius_group-file-extensions.py: -------------------------------------------------------------------------------- 1 | import os; import itertools; print("\n".join("{} -> {}".format(k, ",".join(list(g))) for k, g in itertools.groupby(sorted(os.listdir('.'), key=lambda x: os.path.splitext(x)[1]), key=lambda x: os.path.splitext(x)[1]) if k)) 2 | -------------------------------------------------------------------------------- /python/sorting/OpticGenius_sort-files-date.py: -------------------------------------------------------------------------------- 1 | import os; import datetime; print('\n'.join("{}, {}".format(file, date.strftime("%Y/%m/%d %H:%M:%S.%f")) for date, file in sorted((datetime.datetime.fromtimestamp(os.stat(file).st_mtime), file) for file in os.listdir('.')))) -------------------------------------------------------------------------------- /python/yashagarwal1999_powerset.py: -------------------------------------------------------------------------------- 1 | from itertools import chain, combinations 2 | 3 | def powerset(iterable): 4 | s = list(iterable) 5 | return chain.from_iterable(combinations(s, r) for r in range(len(s)+1)) 6 | 7 | print(list(powerset("abc"))) 8 | -------------------------------------------------------------------------------- /javascript/approximate_e/akargl_approx_e.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Approximate the Euler Number e 3 | * @param {number} iterations 4 | */ 5 | const approx_e = (iterations) => [...Array(iterations)].reduce((accum, _, k) => accum + 1/([...Array(k)].reduce((p, _, i) => p * (i+1), 1)), 0) -------------------------------------------------------------------------------- /scala/even/ivanightingale_onlyEvenDigits.scala: -------------------------------------------------------------------------------- 1 | object onlyEvenDigits{ 2 | def main(args: Array[String]) : Unit = { 3 | val n : Long = scala.io.StdIn.readLine.toLong 4 | if(n.toString.forall(_.asDigit % 2 == 0)) println("all digits are even numbers") 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/cplusplus/e_approximation.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() { 5 | double factorial, e = factorial = 1.0; 6 | for(int i=1; i<10; i++){ 7 | factorial*=i; 8 | e += 1.0 /factorial; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/javascript/largest_contigous_sum_array.js: -------------------------------------------------------------------------------- 1 | function largestContigousArraySum(arr) { 2 | let curr_sum = 0, max_sum = 0; 3 | arr.map((item, i) => max_sum = Math.max(curr_sum = Math.max(0, arr[i] + curr_sum), max_sum)) 4 | return max_sum 5 | } 6 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/javascript/random_alphanumeric.js: -------------------------------------------------------------------------------- 1 | var randomAlphaNumeric = (len) => { for(var rdmString =""; rdmString.length < len; ) rdmString += Math.random().toString(36).substr(2); return rdmString.substr(0, len) }; 2 | 3 | //randomAlphaNumeric(4) 4 | //"88qh" 5 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/rust/fibonacci.rs: -------------------------------------------------------------------------------- 1 | fn fibonacci(x: u8) -> u8 { 2 | match x { 3 | 0 => 1, 4 | 1 => 1, 5 | _ => fibonacci(x - 1) + fibonacci(x - 2), 6 | } 7 | } 8 | 9 | fn main() { 10 | println!("{}", fibonacci(5)); 11 | } 12 | -------------------------------------------------------------------------------- /java/BenjaminUrquhart_SumDigits.java: -------------------------------------------------------------------------------- 1 | //I did them one better: put the entire class on one line (on my phone, no less) 2 | interface SumDigits{static void main(String[]a){System.out.println(a.length==0?"Usage: java SumDigits ":a[0].chars().reduce(0,(x,y)->x+y-'0'));}} 3 | -------------------------------------------------------------------------------- /java/sgirabin_Max2Digit.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | class Max2Digit { 4 | 5 | public static int max(int a, int b) { 6 | return Math.max(a,b); 7 | } 8 | 9 | public static void main(String[] args) { 10 | System.out.println(Max2Digit.max(5,10)); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /scheme/fibonacci/lbarros00_fib.scm: -------------------------------------------------------------------------------- 1 | ; Download DrRacket and set language to R5RS 2 | ; Click Run 3 | 4 | (define (fib n) (cond ((= n 0) 0) ((= n 1) 1) (else (+ (fib (- n 1)) (fib (- n 2)))))) 5 | 6 | ; uncomment the line below to calculate the 2nd Fibonacci number 7 | ; (fib 2) 8 | -------------------------------------------------------------------------------- /swift/anagram/nmasnadithya_anagramChecker.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | // Swift 4 4 | func check(_ a: String, _ b: String) -> Bool { 5 | return a.lowercased().sorted() == b.lowercased().sorted() 6 | } 7 | print(check("anagram","nagaram")) 8 | print(check("rat","car")) 9 | -------------------------------------------------------------------------------- /cplusplus/anagram/s-ankur_anagrams.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main() 6 | { 7 | std::string a,b; 8 | std::cin>>a>>b; 9 | std::cout<<(std::is_permutation(a.begin(),a.end(),b.begin())?"True":"False"); 10 | } 11 | -------------------------------------------------------------------------------- /nodejs/austinkregel_get_files_from_current_directory.js: -------------------------------------------------------------------------------- 1 | const recurseFileFinder = (dir) => require('fs').statSync(dir).isDirectory() ? require('fs').readdirSync(dir).map(file => recurseFileFinder(require('path').join(dir, file))) : dir; console.log(recurseFileFinder(process.cwd())) 2 | -------------------------------------------------------------------------------- /ocaml/rk4n_ycombinator.ml: -------------------------------------------------------------------------------- 1 | let fix f = (fun (`X x) -> f(x (`X x))) (`X(fun (`X x) y -> f(x (`X x)) y));; 2 | 3 | let facRec f = function 4 | 0 -> 1 5 | | n -> n * f (n-1) 6 | 7 | 8 | Printf.printf "%d\n" (fix facRec 2);; 9 | Printf.printf "%d\n" (fix facRec 8);; 10 | -------------------------------------------------------------------------------- /cplusplus/caesar/s-ankur_caesar.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int main() 4 | { 5 | int n; 6 | std::string s;std::cin>>n>>s; 7 | std::transform(s.begin(),s.end(),s.begin(),[n](char c){return (c-'a'+n+26)%26+'a';}); 8 | std::cout< 2 | using namespace std; 3 | int fact(int n) 4 | { 5 | if(n==0) return 1; 6 | else return n*fact(n-1); 7 | } 8 | int main() 9 | { 10 | int n; 11 | cin>>n; 12 | cout<<"\nFactorial of "<(iterations) {Math.sqrt((1..iterations).map{|x| 1.0/x**2}.sum*6)} 4 | 5 | # Test this by running `ruby estimate_pi_basel.rb` 6 | puts approximate_pi_basel.call(10000) 7 | -------------------------------------------------------------------------------- /c/cyucelen_fizzbuzz.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void fizzbuzz(int bound) { 4 | for (int i = 1; i <= bound; i++) !(i % 3) ? (!(i % 5) ? printf("fizzbuzz\n") : printf("fizz\n")) : (!(i % 5) ? printf("buzz\n") : printf("")); 5 | } 6 | 7 | int main() { 8 | fizzbuzz(55); 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /cplusplus/reverse/shweta0310_string_reverse.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | int main() 6 | { 7 | string s; 8 | cout<<"\nEnter string: ";getline(cin,s); 9 | reverse(s.begin(),s.end()); 10 | cout<<"\nReversed string: "< 0] 8 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/nodejs/fibonacci_inMemory.js: -------------------------------------------------------------------------------- 1 | 2 | // Memory efficent fibonacci computation. No memory stack, and array.length never gets larger than 3. 3 | export const fib = n => n <= 0 ? 0 : n < 2 ? 1 : (a => { Array.from(Array(n), () => { a.push(a[0]+a[1]); a.shift(); }); return a.pop(); })([1,1]); 4 | -------------------------------------------------------------------------------- /java/ZombieChibiXD_Palindrome.java: -------------------------------------------------------------------------------- 1 | import java.lang.StringBuffer; 2 | 3 | public class Palindrome 4 | { 5 | public static void main(String[] args) 6 | { 7 | String a = "coc"; 8 | System.out.println("isPalindrome : " + a.equalsIgnoreCase(new StringBuffer(a).reverse().toString())); 9 | } 10 | } -------------------------------------------------------------------------------- /ruby/fibonacci/animanmaster_fibonacci.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # Ruby version 2.5.1 3 | fibonacci = ->(n) { n < 2 ? n : fibonacci.(n - 1) + fibonacci.(n - 2) } 4 | 5 | # Test this by running `ruby fibonacci.rb n` where n is the index in the fibonacci sequence to calculate. 6 | puts fibonacci.call(ARGV[0].to_i) 7 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/python/Fibonacciseries.py: -------------------------------------------------------------------------------- 1 | def fibonacci(n): 2 | if(n <= 1): 3 | return n 4 | else: 5 | return(fibonacci(n-1) + fibonacci(n-2)) 6 | n = int(input("Enter number of terms:")) 7 | print("Fibonacci sequence:") 8 | for i in range(n): 9 | print fibonacci(i), 10 | -------------------------------------------------------------------------------- /r/devAmoghS_excel_dates_to_r.r: -------------------------------------------------------------------------------- 1 | excel_date_to_r_date <- function(excel_date, format) 2 | { 3 | #excel_date is the number of days since the 0th January 1900. See 4 | #http://www.stat.auckland.ac.nz/~paul/ItDT/HTML/node67.html 5 | strftime(as.Date(as.numeric(excel_date) - 2, origin = "1900-01-01"), format) 6 | } 7 | -------------------------------------------------------------------------------- /_assemble/run.js: -------------------------------------------------------------------------------- 1 | // One liner to run a coffeescript file that tests this repository; use "npm test" to start 2 | require('vm').runInThisContext(require('module').wrap(require('coffeescript').compile(`${require('easypathutil')(__dirname)('check.coffee').$readfilesync}`)))(exports, require, module, __filename, __dirname); 3 | -------------------------------------------------------------------------------- /javascript/approximate_pi/akargl_approx_pi.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Get an approximation for pi using the Leibniz formula 3 | * @param {number} iterations Number of iterations to use for approximations 4 | */ 5 | const approx_pi = (iterations) => 4 * [...Array(iterations)].reduce((accum, _, k) => accum + Math.pow(-1, k)/(2 * k +1), 0) -------------------------------------------------------------------------------- /javascript/sorting/igemnace_selection_sort.js: -------------------------------------------------------------------------------- 1 | const selectionSort = (arr, i = arr.length - 1, selected = arr.slice(0, i).reduce((res, val) => val > res ? val : res)) => i === 0 ? arr : selectionSort([...arr.slice(0, i + 1).filter(val => val !== selected), selected, ...arr.slice(i + 1)], --i, i === 0 ? null : undefined) 2 | -------------------------------------------------------------------------------- /java/ernesoglu_Ackermann.java: -------------------------------------------------------------------------------- 1 | public class Ackermann { 2 | private static int ackermann(int m, int n) { return m == 0 ? n + 1 : (m > 0 && n == 0) ? ackermann(m - 1, 1) : ackermann(m - 1, ackermann(m, n - 1)); } 3 | 4 | public static void main(String[] args) { 5 | System.out.println(ackermann(3,4)); 6 | } 7 | } -------------------------------------------------------------------------------- /cplusplus/NeoAnoman_one_line_swap.cpp: -------------------------------------------------------------------------------- 1 | // C/C++ program to swap two variables in single line 2 | #include 3 | int main() 4 | { 5 | int x = 5, y = 10; 6 | (x ^= y), (y ^= x), (x ^= y); 7 | printf("After Swapping values of x and y are %d %d", 8 | x, y); 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /javascript/Xander1233_convert_number_to_one_or_bigger.js: -------------------------------------------------------------------------------- 1 | // This will check if a number is 0 or smaller and then converts it. If 0, to 1. If n < 0, to -n 2 | const convert = (n) => { return (-(~(n ^ 0))) < 0 ? (-(~(n ^ 0))) != -1 ? (-(-(~(n ^ 0)))) + 1 : (-(-(~(n ^ 0)))) : (-(~(n ^ 0))) != 1 ? (-(~(n ^ 0))) - 1 : (-(~(n ^ 0))); } 3 | -------------------------------------------------------------------------------- /powershell/turbosnute_strongpassword.ps1: -------------------------------------------------------------------------------- 1 | # Generates a random strong 20 chars long password. 2 | # If you want to change the length of the password you can cange 20 inside the brackets before the -join to somethin else. 3 | ([char[]]([char]33..[char]95) + ([char[]]([char]97..[char]126)) + 0..9 | Sort-Object {Get-Random})[0..20] -join '' 4 | -------------------------------------------------------------------------------- /python/reverse/bigboynaruto_reverse_sentence.py: -------------------------------------------------------------------------------- 1 | '''This one liner prints a reversed sentence. For example: 2 | 3 | >>> sentence = 'Hacktoberfest for all.' 4 | >>> sentence = sentence[::-1]; print(sentence) 5 | .lla rof tsefrebotkcaH 6 | ''' 7 | sentence = 'Hacktoberfest for all.' 8 | sentence = sentence[::-1]; print(sentence) 9 | -------------------------------------------------------------------------------- /python/unique/Kaljuk_get_word_with_most_unique_characters.py: -------------------------------------------------------------------------------- 1 | # Return the word with most unique characters from the inserted array of words 2 | getUniqueWord = lambda ws: None if (not ws) else max(ws, key=lambda w: None if (not w) else len(set(w))) 3 | 4 | # Example 5 | getUniqueWord(["Summer", "Bananananana", None, "WhATisThIsHmm"]) 6 | 7 | -------------------------------------------------------------------------------- /ruby/approximate_e/shaunak-gupta_approximate_e_stochastic.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # Ruby version 2.5.1 3 | estimate_e = ->(trials) { trials.times.map {1.0/trials.times.map {trials.times.map {rand(trials)==0}.count(true)==0}.count(true)}.sum } 4 | 5 | # Test this by running `ruby estimate_e_stochastic.rb` 6 | puts estimate_e.call(100) 7 | -------------------------------------------------------------------------------- /c/gcd/shubhamdpatil_gcd.c: -------------------------------------------------------------------------------- 1 | /* 2 | * @file: shubhamdpatil_gcd.c 3 | */ 4 | 5 | #include 6 | 7 | int gcd(int x, int y) 8 | { 9 | return (y == 0) ? x : gcd(y, x % y); 10 | } 11 | 12 | int main() 13 | { 14 | int a, b; 15 | scanf("%d %d", &a, &b); 16 | printf("GCD of %d and %d: %d\n", a, b, gcd(a, b)); 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/go/approximate_pi.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | /* 4 | Euler’s number approximation in go 5 | */ 6 | import "fmt" 7 | 8 | func main() { 9 | fmt.Println(piApprox()) 10 | } 11 | 12 | func piApprox() (pi float64) {for k := 1.0; k < 2*200000+1; k = k + 2 { pi = pi + float64(-(int64(k)%4-2))/float64(k)}; return pi * 4} 13 | -------------------------------------------------------------------------------- /dart/hello/gkanishk_hello.dart: -------------------------------------------------------------------------------- 1 | main() { 2 | String tradingSecrets = "High Frequency Trading requires extremely fast computers"; 3 | int latency = 10; 4 | String message = "Google Dart language"; 5 | 6 | print('Hello world in ${message }'); 7 | print("This is String literal just like Java"); 8 | print( '${tradingSecrets}'); 9 | } 10 | -------------------------------------------------------------------------------- /python/OpticGenius_count-filename-letters.py: -------------------------------------------------------------------------------- 1 | import os; import collections; import itertools; import operator; print("\n".join("{} -> {}".format(k, str(v)) for k, v in sorted(collections.Counter(itertools.chain.from_iterable(map(list, map(operator.itemgetter(0), map(os.path.splitext, os.listdir('.')))))).items(), key=operator.itemgetter(1), reverse=True))) -------------------------------------------------------------------------------- /python/adriennelevvie_show2019.py: -------------------------------------------------------------------------------- 1 | import calendar; print(calendar.month(2019,1) + calendar.month(2019,2) + calendar.month(2019,3) + calendar.month(2019,4) + calendar.month(2019,5) + calendar.month(2019,6) + calendar.month(2019,7) + calendar.month(2019,8) + calendar.month(2019,9) + calendar.month(2019,10) + calendar.month(2019,11) + calendar.month(2019,12)) -------------------------------------------------------------------------------- /honorary-one-line-wonders/coffeescript/ytsearcher-example.coffee: -------------------------------------------------------------------------------- 1 | { YTSearcher } = require 'ytsearcher' 2 | search = new YTSearcher '[Redacted YouTube API Key]' 3 | 4 | search.search 'oHg5SJYRHA0', type: 'video' 5 | .then (searchResult) -> 6 | result = searchResult.first 7 | console.log result 8 | console.log "You just got #{result.title}" 9 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/crystal/http_server.cr: -------------------------------------------------------------------------------- 1 | require "http/server" 2 | 3 | server = HTTP::Server.new do |context| 4 | context.response.content_type = "text/plain" 5 | context.response.print "Hello world! The time is #{Time.now}" 6 | end 7 | 8 | address = server.bind_tcp 8080 9 | puts "Listening on http://#{address}" 10 | server.listen 11 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/cplusplus/fib.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void main(){ 5 | int num,first=1,second=1,sum=0; 6 | cout<<"Enter numbers to printed"; 7 | cin>>num; 8 | 9 | for(int i=0;i 2 | using namespace std; 3 | int n, s[10009]; 4 | 5 | int main (){ 6 | scanf("%d", &n); 7 | for(int a=0;a fac = n => (n.Length < 1) ? string.Empty : n[n.Length-1] + fac(n.Substring(0, n.Length - 1)); 10 | 11 | Console.WriteLine(fac(line)); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /c/fibonacci/renanreboredo_fibonacci.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // To run, compile it with gcc and run the executable passing: ./a.out n, n being the number used in the fibonacci 4 | 5 | int fib(int n) { return (n==0 || n==1) ? 1 : (fib(n-1) + fib(n-2)); } 6 | 7 | int main(int argc, char *argv[]) { 8 | printf("Fibonacci: %d\n", fib((int) *argv[1] - '0')); 9 | } 10 | -------------------------------------------------------------------------------- /coffeescript/hello/wzhouwzhou_hello-functions.coffee: -------------------------------------------------------------------------------- 1 | do (-> -> do do do -> do -> do do do do do do do do do do do do -> -> -> -> -> do do do do -> -> -> do do -> -> -> -> -> -> -> -> -> -> -> -> do (do -> -> do -> do -> do do -> -> -> console.log.apply 0, do -> [do -> [do do do -> -> do do -> -> -> 'Hello, world!', do -> do -> [] + [[] + [[]], [[]] + +[]][+[]]][+[]]])())() 2 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/clojure/ycombinator.clj: -------------------------------------------------------------------------------- 1 | (defn Fix [f] 2 | ((fn [x] (x x)) 3 | (fn [x] 4 | (f (fn [& args] 5 | (apply (x x) args)))))) 6 | 7 | (def fac-rec 8 | (fn [f] 9 | (fn [n] 10 | if (zero? n) 1 11 | (* n (f (dec n))))))) 12 | 13 | 14 | (def fac (Fix fac-rec)) 15 | 16 | (println (fac 2)) 17 | (println (fac 8)) 18 | -------------------------------------------------------------------------------- /bash/jackkav_retry_until.sh: -------------------------------------------------------------------------------- 1 | # will attempt to retry a given command until it is successful of exceeds attempts 2 | # e.g. to wait for a server to come up, retrying 3 times every 5 seconds 3 | # for i in 1 2 3; do ping 10.0.0.1 && break || sleep 5; done 4 | # [5 attempts] [command] [1 second retry interval] 5 | for i in 1 2 3 4 5; do command && break || sleep 1; done 6 | -------------------------------------------------------------------------------- /c/swap/shubhamdpatil_swap.c: -------------------------------------------------------------------------------- 1 | /* 2 | * @file: shubhamdpatil_swap.c 3 | */ 4 | 5 | #include 6 | 7 | #define swap(x, y) ((x ^= y), (y ^= x), (x ^= y)) 8 | 9 | int main() 10 | { 11 | int a, b; 12 | scanf("%d %d", &a, &b); 13 | printf("Before swap: %d, %d\n", a, b); 14 | 15 | swap(a, b); 16 | printf("After swap: %d, %d\n", a, b); 17 | return 0; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /python/Priultimus_day.py: -------------------------------------------------------------------------------- 1 | print("Monday" if datetime.datetime.today().weekday() == 0 else "Tuesday" if datetime.datetime.today().weekday() == 1 else "Wednesday" if datetime.datetime.today().weekday() == 2 else "Thursday" if datetime.datetime.today().weekday() == 3 else "Friday" if datetime.datetime.today().weekday() == 4 else "Saturday" if datetime.datetime.today().weekday() == 5 else "Sunday") 2 | -------------------------------------------------------------------------------- /python/unique/moonblade_twoStrings.py: -------------------------------------------------------------------------------- 1 | # solution to python problem https://www.hackerrank.com/challenges/two-strings/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=dictionaries-hashmaps 2 | twoStrings = lambda s1, s2: "YES" if any(set(s1)&set(s2)) else "NO" 3 | 4 | assert(twoStrings("hello", "world")) == "YES" 5 | assert(twoStrings("hello", "wrd")) == "NO" -------------------------------------------------------------------------------- /c/approximate_pi/cyucelen_pi_wallis_product.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | float pi_wallis_product(size_t iteration_count, size_t i, float pi) { 5 | return i < iteration_count ? pi_wallis_product(iteration_count, i + 1, pi * (1-(1/(pow(1+(2*i),2))))) : 4*pi; 6 | } 7 | 8 | int main() { 9 | printf("%.16lf\n",pi_wallis_product(100000, 1, 1)); 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /javascript/tnptop_tuplesToObject.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Convert an array of tuples into an object 3 | * The function assumes the first element of each tuple is the desired keys 4 | * If a tuple contains more than two element, all but the first element will be grouped into an array 5 | */ 6 | const tuplesToObject = (tuples) => tuples.reduce((obj, [key, ...value]) => Object.assign({ [key]: value }, obj), {}) 7 | -------------------------------------------------------------------------------- /python/sorting/ngweihow_bogosort.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Bogosort created using lambda. 3 | 4 | @author: ngweihow (github.com/ngweihow) 5 | ''' 6 | from random import sample 7 | 8 | b_sort = lambda ls: ls if all(ls[i] <= ls[i+1] for i in range(len(ls)-1)) else b_sort(sample(ls, len(ls))) 9 | 10 | # Tests (PLEASE DO NOT TEST WITH LARGE LIST INPUT, BOGOSORT IS HIGHLY INEFFICIENT) 11 | print(b_sort([4,3,2,1])) -------------------------------------------------------------------------------- /honorary-one-line-wonders/cplusplus/U3X_check_square.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | void issquare(long long int a){ 6 | int flag=1; for(long long i=1;i<=a/2+1;i++){ if(i*i==a) {cout<<"it is a square number\n";flag=0;} }if(flag==1) cout<<"Not a square number\n"; 7 | } 8 | 9 | int main(){ 10 | long long int a; 11 | cin>>a; 12 | issquare(a); 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/html/Hello_World.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | HELLO WORLD 4 | 9 | 10 | 11 |

Welcome to Hacktober Fest!!!

12 |

Welcome to one-line-wonders

13 |

WISHING YOU A HAPPY CODING

14 | 15 | 16 | -------------------------------------------------------------------------------- /python/caesar/s-ankur_caesar.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Author: Ankur Sonawane (https://github.com/s-ankur) 4 | 5 | To use: `python caesar.py ` 6 | python caesar.py 1 abcz 7 | >>> bcda 8 | python caesar.py -3 ankur 9 | >>> xkhro 10 | python caesar.py xkhro 11 | >>> ankur 12 | """ 13 | 14 | import sys 15 | print(''.join(map((lambda x: chr((ord(x)+int(sys.argv[1])-97)%26+97)),sys.argv[2]))) 16 | -------------------------------------------------------------------------------- /go/approximate_phi/hurlenko_approximate_phi.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | func main() { 8 | fmt.Println(phi(1000)) // number of iterations 9 | } 10 | 11 | func phi(args... float64) float64 { if iters := args[0]; iters > 0 { return func() float64 { if len(args) == 1 { return phi(iters - 1, 1 + 1.0 / 1)} else {return phi(iters - 1, 1 + 1.0 / args[1])} }()} else { return args[1]}} -------------------------------------------------------------------------------- /python/moonblade_leftRotate.py: -------------------------------------------------------------------------------- 1 | # Rotate an array left, d times hackerrank question https://www.hackerrank.com/challenges/ctci-array-left-rotation/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=arrays 2 | def leftrotate(array, amount): 3 | return array[amount:] + array[:amount] 4 | # leftrotate = lambda array, amount: array[amount:] + array[:amount] 5 | print(leftrotate([1,2,3,4,5], 3)) 6 | -------------------------------------------------------------------------------- /python/sorting/blicharski_select_sort_1_line.py: -------------------------------------------------------------------------------- 1 | def select_sort(a): 2 | return [a.pop(a.index(min(a))) for _ in range(len(a))] 3 | 4 | 5 | 6 | ## TEST 7 | test = [5, -1, 2, 4, 0] 8 | test_sorted = sorted(test) 9 | test_select_sort = select_sort(test[:]) 10 | 11 | 12 | print(test) 13 | print(test_sorted) 14 | print(test_select_sort) 15 | 16 | for i in range(len(test)): 17 | assert test_sorted[i] == test_select_sort[i] 18 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/powershell/download_and_install_7-zip.ps1: -------------------------------------------------------------------------------- 1 | # This will only work on Windows 10 Version 1803 and newer, because curl.exe was not included with Windows before that. 2 | # The same one-liner could be made to work on old Windows versions, but it would be longer. 3 | 4 | $u='https://www.7-zip.org';-join (curl.exe $u -s) -match '[^"]*x64\.exe';curl.exe -O $u/$($matches.Values);& ($matches.Values -replace ".*/",".\") /S 5 | -------------------------------------------------------------------------------- /c/caesar/s-ankur_caesar.c: -------------------------------------------------------------------------------- 1 | // Author: Ankur S (www.github.com/s-ankur) 2 | // Caesar Cipher C Style 3 | // Usage: 4 | // gcc caesar.c 5 | // ./a.out 6 | // Input: 7 | // Output: 8 | 9 | #include 10 | int main() 11 | { 12 | char s[100]; 13 | int n; 14 | scanf("%d %s",&n,s); 15 | for(char * sp=s;*sp && (*sp=(*sp+n-'a'+26)%26+'a') ;sp++); 16 | printf("%s",s); 17 | } 18 | -------------------------------------------------------------------------------- /cplusplus/ZombieChibiXD_Palindrome.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | bool isPalindrome(std::string input) { return input == std::string(input.rbegin(), input.rend()); } 5 | 6 | int main() 7 | { 8 | std::string input = "able was I ere I saw elba" ; 9 | //std::cout << "Input : "; 10 | //getline (std::cin, input); 11 | std::cout << "It is " << (isPalindrome(input) ? "" : "not ") << "a palindrome"; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/python/reversePy_subratred.py: -------------------------------------------------------------------------------- 1 | # Python code to reverse a string 2 | # using loop 3 | 4 | def reverse(s): 5 | str = "" 6 | for i in s: 7 | str = i + str 8 | return str 9 | 10 | s = "Test Hacktober Fun Fest. I love Freelancing" 11 | 12 | print ("The original string is : ",end="") 13 | print (s) 14 | 15 | print ("The reversed string(using loops) is : ",end="") 16 | print (reverse(s)) 17 | -------------------------------------------------------------------------------- /r/MattSandy_print_loaded_packages.r: -------------------------------------------------------------------------------- 1 | # Prints loaded packages in a format you can paste in your script 2 | grep("package:", search()) %>% search()[.] %>% gsub("package:", 'library("', .) %>% paste0('")') %>% cat(sep = "\n") 3 | 4 | # Sample output 5 | # library("magrittr") 6 | # library("stats") 7 | # library("graphics") 8 | # library("grDevices") 9 | # library("utils") 10 | # library("datasets") 11 | # library("methods") 12 | # library("base") -------------------------------------------------------------------------------- /javascript/sorting/akargl_insertion_sort.js: -------------------------------------------------------------------------------- 1 | /** 2 | * One line insertion sort 3 | * Each reduce step builds new array with all smaller values than the current one inserted into a new list, followed by the current value and all bigger values 4 | * 5 | * @param {number[]} arr 6 | * @returns {number[]} 7 | */ 8 | const insertionSort = (arr) => arr.reduce((sorted, currentVal) => [...sorted.filter((n) => n <= currentVal), currentVal, ...sorted.filter((n) => n > currentVal)], []) -------------------------------------------------------------------------------- /honorary-one-line-wonders/java/ValidAnagram.java: -------------------------------------------------------------------------------- 1 | class ValidAnagram { 2 | 3 | public static boolean isAnagram(String s, String t) { 4 | char[] x = s.toCharArray(); 5 | char[] y = s.toCharArray(); 6 | 7 | Arrays.sort(x); 8 | Arrays.sort(y); 9 | 10 | return Arrays.equals(x,y); 11 | } 12 | 13 | public static void main(String[] args) { 14 | System.out.println(isAnagram("car","rat")); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /go/sorting/isears_bubblesort.go: -------------------------------------------------------------------------------- 1 | package main 2 | /* 3 | go run bubblesort.go 4 | 5 | One-liner bubblesort in go 6 | */ 7 | import "fmt" 8 | 9 | func main(){ 10 | test_array := []int{15, 3, 0, -40, 3, 3623450, 9, 9, 2, 86} 11 | oneLinerBubbleSort(&test_array) 12 | fmt.Println(test_array) 13 | } 14 | 15 | func oneLinerBubbleSort(a *[]int){ 16 | for i := 0; i < (len(*a) * len(*a)); i++ { for j := 1; j < len(*a); j++ { if (*a)[j-1] > (*a)[j] { (*a)[j-1], (*a)[j] = (*a)[j], (*a)[j-1]}}} 17 | } -------------------------------------------------------------------------------- /c/palindrome/GeoffYart_palindrome_check.c: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | gcc palindrome_check.c 4 | ./a.out 5 | Finds length of string 6 | */ 7 | 8 | #include 9 | #include 10 | 11 | int palindrome_check(char *buffer) { 12 | return !strcmp(buffer, reverse(buffer)); 13 | } 14 | 15 | int main(int argc, char **argv){ 16 | scanf("[^\n]\n", buffer); 17 | if (palindrome_check(buffer)) 18 | printf("Palindrome\n"); 19 | else 20 | printf("Not a palindrome\n"); 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/python/verify_variable_type.py: -------------------------------------------------------------------------------- 1 | string = 'this is a string' 2 | print(type(string)) 3 | 4 | integer = 1 5 | print(type(integer)) 6 | 7 | float_ = 10.5 8 | print(type(float)) 9 | 10 | complex_ = 3j 11 | print(type(complex)) 12 | 13 | tuple_ = (1, 'yeap', True) 14 | print(type(tuple)) 15 | 16 | list_ = ['red', 'blue', 'yellow'] 17 | print(type(list_)) 18 | 19 | dictionary = { 20 | 'key': 'value', 21 | 'another_key': 'another value' 22 | } 23 | print(type(dictionary)) 24 | -------------------------------------------------------------------------------- /go/approximate_pi/hurlenko_approximate_pi.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | /* 4 | Euler’s number approximation in go 5 | */ 6 | import "fmt" 7 | 8 | func main() { 9 | fmt.Println(piApprox(1000000)) // number of iterations 10 | } 11 | 12 | func piApprox(args... float64) float64 {if iters := args[0]; iters != -1 { return func() float64 { if len(args) == 1 {return piApprox(2 * iters - 1, 0)} else {return piApprox(iters - 2, args[1] + float64(-(int64(iters) % 4 - 2)) / float64(iters))}}()} else {return args[1] * 4.0}} 13 | 14 | -------------------------------------------------------------------------------- /rust/prime/Henning-K_prime.rs: -------------------------------------------------------------------------------- 1 | // inspired by the C version in this repo 2 | 3 | use std::env; 4 | use std::str::FromStr; 5 | 6 | // Compile with rustc, run using the form "./Henning-K_prime " 7 | fn main() { 8 | let n = usize::from_str(&env::args().nth(1).expect("Not enough arguments.")).expect("Positive integer expected."); 9 | println!("{} is {}prime.", n, if is_prime(n) {""} else {"not "}); 10 | } 11 | 12 | fn is_prime(n: usize) -> bool { if n>1 { !(2..n).any(|i| n%i==0)} else { false } } 13 | -------------------------------------------------------------------------------- /cplusplus/unique/remove_duplicates.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | // Expected return of [1, 4, 2, 50, 3, 70, 14] 7 | int duplicates[10] = {1, 4, 2, 1, 50, 50, 3, 2, 70, 14}; 8 | std::set nonDuplicates; 9 | std::set::iterator it; 10 | //Spaghetti code BUT it is one line 11 | for (int i = 0; i < 10; i++) nonDuplicates.insert(duplicates[i]); for (it = nonDuplicates.begin(); it != nonDuplicates.end(); it++) std::cout << *it << ", "; 12 | } 13 | -------------------------------------------------------------------------------- /python/s-ankur_xor_cipher.py: -------------------------------------------------------------------------------- 1 | """ 2 | Author: Ankur S (www.github.com/s-ankur) 3 | 4 | TO use: 5 | python xor_cipher.py 6 | 7 | 8 | Example: 9 | Encrypt (Stored in ciphertext.bin) 10 | python xor_cipher.py ankur > ciphertext.bin 11 | Input: idontlikeapples 12 | 13 | Decrypt 14 | python xor_cipher.py ankur < ciphertex.bin 15 | Output: idontlikeapples 16 | """ 17 | 18 | print(''.join(map(lambda x: chr(ord(x[0])^ord(x[1])), zip(__import__('itertools').cycle(__import__('sys').argv[1]),input())))) 19 | -------------------------------------------------------------------------------- /cplusplus/unique/jagwiredev_remove_duplicates.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | // Expected return of [1, 4, 2, 50, 3, 70, 14] 7 | int duplicates[10] = {1, 4, 2, 1, 50, 50, 3, 2, 70, 14}; 8 | std::set nonDuplicates; 9 | std::set::iterator it; 10 | //Spaghetti code BUT it is one line 11 | for (int i = 0; i < 10; i++) nonDuplicates.insert(duplicates[i]); for (it = nonDuplicates.begin(); it != nonDuplicates.end(); it++) std::cout << *it << ", "; 12 | } 13 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/javascript/ycombinator.js: -------------------------------------------------------------------------------- 1 | var Fix = function (f) { 2 | return function (x) { 3 | return x(x); 4 | }(function (x) { 5 | return f( 6 | function (a) { return (x(x))(a); } 7 | ); 8 | }); 9 | }; 10 | 11 | 12 | var fac = Fix(function(f){ 13 | return function(n){ 14 | if(n !== 0){ 15 | return n * f(n-1); 16 | } else { 17 | return 1; 18 | } 19 | } 20 | }); 21 | 22 | console.log(fac(2)); 23 | console.log(fac(8)); 24 | -------------------------------------------------------------------------------- /powershell/jantari_download_and_install_7-zip.ps1: -------------------------------------------------------------------------------- 1 | # This will only work on Windows 10 Version 1803 and newer, because curl.exe was not included with Windows before that. 2 | # The same one-liner could be made to work on old Windows versions, but it would be longer. 3 | # Also, this is super-janky (redirecting curls stderr to grab the filename) and only for fun. 4 | 5 | & ".\$([regex]::Match(-join (curl.exe -O ('https://www.7-zip.org/{0}' -f [regex]::Match(-join (curl.exe 'https://www.7-zip.org' -s), '[^"]*x64\.exe').Value) -v 2>&1), '[^/]*x64\.exe').Value)" /S -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature Request 3 | about: Suggest an idea for this project. 4 | 5 | --- 6 | 7 | **Describe the solution you'd like** 8 | A clear and concise description of what you want to happen. 9 | 10 | **Is a one-line solution absolutely essential? If not, should it be concise? Do we value efficiency over size?** 11 | A clear and concise description of any alternative solutions or features you've considered. 12 | 13 | **Additional context** 14 | Add any other context or screenshots about the feature request here. 15 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/python/SeiveOfEratosthenes.py: -------------------------------------------------------------------------------- 1 | def SOE(n): 2 | prime = [True for i in range(n+1)] 3 | p = 2 4 | while (p * p <= n): 5 | if (prime[p] == True): 6 | for i in range(p * 2, n+1, p): 7 | prime[i] = False 8 | p += 1 9 | 10 | 11 | for p in range(2, n): 12 | if prime[p]: 13 | print(p) 14 | 15 | if __name__=='__main__': 16 | n = int(input("Enter a number:")) 17 | print("Following are the prime numbers smaller than or equal to",n,":") 18 | SOE(n) 19 | -------------------------------------------------------------------------------- /java/sorting/Akash-Sareen_SortExample.java: -------------------------------------------------------------------------------- 1 | // A sample Java program to sort an array of integers 2 | // using Arrays.sort(). It by default sorts in 3 | // ascending order 4 | import java.util.Arrays; 5 | 6 | public class SortExample 7 | { 8 | public static void main(String[] args) 9 | { 10 | // Our arr contains 8 elements 11 | int[] arr = {13, 7, 6, 45, 21, 9, 101, 102}; 12 | 13 | Arrays.sort(arr); 14 | 15 | System.out.printf("Modified arr[] : %s", 16 | Arrays.toString(arr)); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ruby/fibonacci/animanmaster_fibonacci_iterative.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # Ruby version 2.5.1 3 | # Calculate the fibonacci sequence iteratively by passing along fib(n-2) and fib(n-1) through each iteration of the loop. 4 | # The resulting fibonacci number is the sum of the last iteration of the loop. 5 | fibonacci = ->(n) { n < 2 ? n : 1.upto(n - 2).inject([0, 1]) { |last_two, i| fib = last_two.sum and [last_two[1], fib] }.sum } 6 | 7 | # Test this by running `ruby fibonacci_iterative.rb n` where n is the index in the fibonacci sequence to calculate. 8 | puts fibonacci.call(ARGV[0].to_i) 9 | -------------------------------------------------------------------------------- /java/PRITI1999_sum_of_natural_numbers.java: -------------------------------------------------------------------------------- 1 | /* 2 | @author : Priti Chattopadhyay 3 | */ 4 | 5 | //importing necessary packages 6 | import java.util.*; 7 | 8 | public class sum_of_natural_numbers{ 9 | 10 | //one line to find sum of N natural numbers 11 | int findSum(int N){ return (N*(N + 1))/2;} 12 | 13 | //Driver code to test the function 14 | public static void main(String args[]){ 15 | Scanner sc = new Scanner(System.in); 16 | sum_of_natural_numbers obj = new sum_of_natural_numbers(); 17 | int N; 18 | N = sc.nextInt(); 19 | System.out.println(obj.findSum(N)); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/cplusplus/yashagarwal1999_countingValley.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | typedef long long int ll; 4 | int countingValleys(int n, string s) { 5 | 6 | 7 | int sum=0; 8 | if(s[0]=='U')sum++; 9 | else sum--; 10 | int count=0; 11 | if(sum<0)count++; 12 | for(int i=1;i>n; 26 | string s; 27 | cin>>s; 28 | cout< 7 | using namespace std; 8 | 9 | long long int fact(int n){ return (n == 0 || n == 1)? 1 : (n*fact(n-1)) ; } 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | std::cout << "Factorial of "<< (int) *argv[1] - '0' <<" is : "<< fact( (int) *argv[1] - '0' ); 14 | } 15 | -------------------------------------------------------------------------------- /c/bigboynaruto_one_lineifier.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void print_one_line(FILE *in) { 4 | for (char temp; fscanf(in, "%c", &temp) != -1;) if (temp != '\n') printf("%c", temp); 5 | } 6 | 7 | int main(int argc, char **argv) { 8 | if (argc != 2) { 9 | printf("Error: Invalid number of arguments!\n"); 10 | printf("Usage: one_lineifier.c \n"); 11 | return -1; 12 | } 13 | FILE *in = NULL; 14 | in = fopen(argv[1], "r"); 15 | if (in == NULL) { 16 | printf("Error: Input not available for reading!\n"); 17 | return -1; 18 | } 19 | 20 | print_one_line(in); 21 | 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /javascript/wzhouwzhou_check_brackets.js: -------------------------------------------------------------------------------- 1 | const b=['()','[]','{}'],d=b.reduce((o,e)=>Object.defineProperty(o,e[0],{value:e[1]}),{}),c=b.map((e,i)=>Object.defineProperty(Object.defineProperty({},[]+e[0],{value:[i,1],enumerable:!0}),[]+e[1],{value:[i,-1],enumerable:!0})).reduce((a,b)=>Object.assign(a,b),{}),check_brackets=str=>str.split``.filter(e=>'()[]{}'.includes(e)).reduce((a,n)=>(a.some(e=>e<0)?a[3]=!0:c[n][1]==-1&&a[4]&&n!=d[a[4]]?a[3]=!0:(a[c[n][0]]+=c[n][1]),c[n][1]==1?a[4]=n:a[4]='',a),[0,0,0,!1]).filter((e,i)=>i<4).every(e=>!e); 2 | 3 | check_brackets('Some [awesome (string)] to {check}'); 4 | check_brackets('Less [awesome (string}] to {check}'); 5 | -------------------------------------------------------------------------------- /java/janeliutw_StreamExample.java: -------------------------------------------------------------------------------- 1 | import java.util.Arrays; 2 | import java.util.List; 3 | import java.util.ArrayList; 4 | import java.util.stream.Collectors; 5 | 6 | public class StreamExample{ 7 | public static void main(String[] args) 8 | { 9 | 10 | List animals = new ArrayList(Arrays.asList("Hairy dog", "Shorty dog", "Grumpy cat", "Shiba Inu dog", "Lion dog", "Kitty cat")); 11 | 12 | // Collect strings that contain "dog" to a list 13 | List dogs = animals.stream().filter(o->o.contains("dog")).collect(Collectors.toList());; 14 | 15 | System.out.println(dogs); 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /cplusplus/unique/ahnafhf21_remove_duplicate_elements.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | int i, j, k, n; 7 | cout << "How many elements? "; cin >> n; 8 | int a[n]; 9 | cout << endl << "Enter elements of array" << endl; 10 | for(i = 0;i < n; ++i) cin >> a[i]; 11 | 12 | // One line insertion via == lookup loop 13 | for(i = 0; i < n; ++i) for(j = i + 1; j < n; ++j) if (a[i] == a[j]) for(--n, k = j--; k < n; ++k) a[k] = a[k + 1]; 14 | 15 | cout << n << " unique" << endl; 16 | for(i = 0; i < n; ++i) cout << a[i] << ' '; 17 | cout << endl; 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/cplusplus/yashagarwal1999_Largest _sum_of_consecutive_numbers_in_an_array.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | typedef long long int ll; 4 | pair maxsum(ll arr[],ll n) 5 | { 6 | ll sum=0; 7 | ll max=0; 8 | pairp; 9 | ll x=0,y=0; 10 | for(ll i=0;imax){max=sum;y=i;} 14 | if(sum<0){sum=0;x=i+1;} 15 | 16 | } 17 | p.first=x; 18 | p.second=y; 19 | return p; 20 | } 21 | 22 | int main() 23 | { 24 | int n; 25 | cin>>n; 26 | ll arr[n]; 27 | for(ll i=0;i>arr[i]; 28 | pairp=maxsum(arr,n); 29 | cout< toGetMaxOf) { 14 | return toGetMaxOf.stream().collect(Collectors.summarizingInt(Integer::intValue)).getMax(); 15 | } 16 | 17 | public static void main(String[] args) { 18 | Integer[] toGetMaxOf = {1, 3, 2, 4, 5, 6, 2}; 19 | System.out.printf(getMax(new ArrayList<>(Arrays.asList(toGetMaxOf))).toString()); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/python/merge.py: -------------------------------------------------------------------------------- 1 | #merge 2 sorted arrays 2 | a = [] 3 | b = [] 4 | c=[] 5 | i=0 6 | j=0 7 | 8 | n1=int(input("size of array A: ")) 9 | for i in range(n1): 10 | a.append(int(input("array element: "))) 11 | 12 | n2=int(input("size of array B: ")) 13 | for i in range(n2): 14 | b.append(int(input("array element: "))) 15 | 16 | i=0 17 | 18 | while (i 0: 10 | # output += ', ' 11 | # output += string + str(numbers[i]) 12 | # return output 13 | # 14 | # Here is an elegant way with Output $0, $1, $2, $3, $4- 15 | 16 | def foo(string, numbers): return ', '.join(map(lambda s,n:s+str(n), [string for i in numbers], numbers)) 17 | -------------------------------------------------------------------------------- /c/sorting/isears_bubblesort.c: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | gcc bubblesort.c 4 | ./a.out 5 | 6 | 99% solution for bubble sort 7 | */ 8 | 9 | #include 10 | 11 | # define ITERATIONS 1000000 // more iterations for greater chance of actually sorting; fewer for more efficiency ;) 12 | 13 | void oneLinerBubbleSort(int * a, int s){ 14 | for(int i=0; i [Int] 12 | mergeSort [] = [] 13 | mergeSort [x] = [x] 14 | mergeSort xs = merge (mergeSort lft) (mergeSort rgt) 15 | where 16 | len = length xs `div` 2 17 | lft = take len xs 18 | rgt = drop len xs 19 | 20 | merge :: [Int] -> [Int] -> [Int] 21 | merge x [] = x 22 | merge [] y = y 23 | merge (x:xs) (y:ys) 24 | | x == y = x:y:merge xs ys 25 | | x > y = y:merge (x:xs) ys 26 | | x < y = x:merge xs (y:ys) 27 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/cpp/Fibonacci in cpp.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | int n, t1 = 0, t2 = 1, nextTerm = 0; 7 | 8 | cout << "Enter the number of terms: "; 9 | cin >> n; 10 | 11 | cout << "Fibonacci Series: "; 12 | 13 | for (int i = 1; i <= n; ++i) 14 | { 15 | // Prints the first two terms. 16 | if(i == 1) 17 | { 18 | cout << " " << t1; 19 | continue; 20 | } 21 | if(i == 2) 22 | { 23 | cout << t2 << " "; 24 | continue; 25 | } 26 | nextTerm = t1 + t2; 27 | t1 = t2; 28 | t2 = nextTerm; 29 | 30 | cout << nextTerm << " "; 31 | } 32 | return 0; 33 | } 34 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/python/validAnagram.py: -------------------------------------------------------------------------------- 1 | class validAnagram: 2 | def makeDic(self, s): 3 | D = {} 4 | for term in s: 5 | if term in D: 6 | D[term] += 1 7 | else: 8 | D[term] = 1 9 | return D 10 | def isAnagram(self, s, t): 11 | """ 12 | :type s: str 13 | :type t: str 14 | :rtype: bool 15 | """ 16 | myD = self.makeDic(s) 17 | for term in t: 18 | if term not in myD: 19 | return False 20 | else: 21 | myD[term] -= 1 22 | if myD[term] < 0: 23 | return False 24 | for char in myD: 25 | if myD[char] != 0: 26 | return False 27 | return True 28 | -------------------------------------------------------------------------------- /rust/maths/ngweihow_areacircle.rs: -------------------------------------------------------------------------------- 1 | /** 2 | Simple Rust One Liner to calculate area of circle. 3 | Made to have fun and learn Rust. This is my first time writing working code in Rust. 4 | 5 | Requires Cargo. 6 | @author: github.com/ngweihow 7 | */ 8 | use std::io; 9 | use std::f32::consts::PI; 10 | 11 | fn main() { 12 | println!("Enter the radius of the circle you want to calculate the area of: "); 13 | 14 | let mut input = String::new(); 15 | io::stdin().read_line(&mut input) 16 | .expect("Failed to read line!"); 17 | 18 | let float_input = input.trim().parse::().expect("Invalid Input!"); 19 | 20 | println!("The area of your circle is {} unit squared!", area_of_circle(float_input)); 21 | } 22 | 23 | // Area of circle one liner. 24 | fn area_of_circle(r: f32) -> f32 { r.powf(2.0) * PI } 25 | -------------------------------------------------------------------------------- /python/anagram/s-ankur_decode_anagram.py: -------------------------------------------------------------------------------- 1 | """ 2 | To Use 3 | python3.6 decode_anagram.py 4 | Input: ilne 5 | Output: line 6 | 7 | Input: loev 8 | Output: love 9 | 10 | Requirements: 11 | Python3.6 12 | requests package 13 | internet connection 14 | 15 | Beware: 16 | Since it queries wikitionary many times, its speed is very low. 17 | Moreover, the time complexity is Factorial so if len(word) > 6, 18 | it is unlikely to answer today 19 | It may or may not be pep8 compliant 20 | 21 | """ 22 | 23 | print(''.join(max(__import__('itertools').permutations(input()),key=lambda x:getattr(__import__('requests').get(f"http://en.wiktionary.org/w/api.php?action=query&titles={''.join(x)}&prop=pageviews&pvipdays=1&format=json").json()['query']['pages'].values().__iter__().__next__()['pageviews'].values().__iter__().__next__(),'real',-1)))) 24 | -------------------------------------------------------------------------------- /java/approximate_pi/edgriebel_WallisPi.java: -------------------------------------------------------------------------------- 1 | import java.util.stream.IntStream; 2 | 3 | /** 4 | * Use Wallis method to find pi: https://en.wikipedia.org/wiki/Wallis_product 5 | * 6 | * Need to use streams because simple iteration exits with stack overflow 7 | * unless huge stack is configured at runtime and Java doesn't do 8 | * Tail Call Optimization/Elimination https://en.wikipedia.org/wiki/Tail_call 9 | */ 10 | public class WallisPi { 11 | 12 | // Use Wallis method to find PI 13 | 14 | static double pi_wallis_product_stream(int iteration_count) { 15 | return 4 * IntStream.range(1, iteration_count).mapToDouble(j -> (1-(1/(Math.pow(1+(2*j),2))))).reduce(1, (x,y) -> x*y); 16 | } 17 | 18 | public static void main(String [] args) { 19 | System.out.printf("%.16f\n",pi_wallis_product_stream(100000)); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /cplusplus/prime/radensaleh_T-Primes.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | 6 | long long n, temp; 7 | bitset<10000005> bs; 8 | 9 | void sieve(long long x) 10 | { 11 | bs.set(); 12 | bs[0] = bs[1] = 0; 13 | for (long long a = 2; a <= x; a++) 14 | if (bs[a]) 15 | for (long long b = a * a; b <= x; b += a) 16 | bs[b] = 0; 17 | } 18 | 19 | bool T_Primes(long long x) 20 | { 21 | if (bs[(int)sqrt(x)] && (long long)sqrt(x) * (long long)sqrt(x) == x) 22 | return true; 23 | return false; 24 | } 25 | 26 | int main() 27 | { 28 | sieve(10000000); 29 | cin >> n; 30 | while (n--) { 31 | cin >> temp; 32 | if (T_Primes(temp)) 33 | cout << "YES\n"; 34 | else 35 | cout << "NO\n"; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/cplusplus/cchha.cpp: -------------------------------------------------------------------------------- 1 | // C++ program to print largest contiguous array sum 2 | #include 3 | #include 4 | using namespace std; 5 | 6 | int maxSubArraySum(int a[], int size) 7 | { 8 | int max_so_far = INT_MIN, max_ending_here = 0; 9 | 10 | for (int i = 0; i < size; i++) 11 | { 12 | max_ending_here = max_ending_here + a[i]; 13 | if (max_so_far < max_ending_here) 14 | max_so_far = max_ending_here; 15 | 16 | if (max_ending_here < 0) 17 | max_ending_here = 0; 18 | } 19 | return max_so_far; 20 | } 21 | 22 | /*Driver program to test maxSubArraySum*/ 23 | int main() 24 | { 25 | int a[] = {-2, -3, 4, -1, -2, 1, 5, -3}; 26 | int n = sizeof(a)/sizeof(a[0]); 27 | int max_sum = maxSubArraySum(a, n); 28 | cout << "Maximum contiguous sum is " << max_sum; 29 | return 0; 30 | } 31 | 32 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve existing programs in the repository. 4 | 5 | --- 6 | 7 | **Describe the bug** 8 | A clear and concise description of what the bug is. 9 | 10 | **To Reproduce** 11 | Steps to reproduce the behavior: 12 | 1. Go to '...' 13 | 2. Click on '....' 14 | 3. Scroll down to '....' 15 | 4. See error 16 | 17 | **Expected behavior** 18 | A clear and concise description of what you expected to happen. 19 | 20 | **Screenshots** 21 | If applicable, add screenshots to help explain your problem. 22 | 23 | **Desktop (please complete the following information):** 24 | - OS: [e.g. iOS] 25 | - Browser [e.g. chrome, safari] 26 | - Version [e.g. 22] 27 | 28 | **Smartphone (please complete the following information):** 29 | - Device: [e.g. iPhone6] 30 | - OS: [e.g. iOS8.1] 31 | - Browser [e.g. stock browser, safari] 32 | - Version [e.g. 22] 33 | 34 | **Additional context** 35 | Add any other context about the problem here. 36 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "one-line-wonders", 3 | "version": "1.0.0", 4 | "description": "An actively maintained collection of \"one-line\" programs in various languages, performing various tasks", 5 | "main": "./_assemble/index.js", 6 | "dependencies": { 7 | "easypathutil": "^1.1.1" 8 | }, 9 | "devDependencies": { 10 | "coffeescript": "^2.3.2" 11 | }, 12 | "scripts": { 13 | "test": "node ./_assemble/run.js" 14 | }, 15 | "repository": { 16 | "type": "git", 17 | "url": "git+https://github.com/kannagikazuko/one-line-wonders.git" 18 | }, 19 | "keywords": [ 20 | "hacktoberfest", 21 | "one-line", 22 | "open-source", 23 | "maintained", 24 | "one-line-wonders", 25 | "one-line-wonders-code" 26 | ], 27 | "author": "One Line Wonders Code (William Zhou)", 28 | "license": "GPL-3.0", 29 | "bugs": { 30 | "url": "https://github.com/kannagikazuko/one-line-wonders/issues" 31 | }, 32 | "homepage": "https://github.com/kannagikazuko/one-line-wonders#readme" 33 | } 34 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/c/one_lineifier.c: -------------------------------------------------------------------------------- 1 | /* 2 | * One Lineifier 3 | * Command line program that takes a text file as input 4 | * and outputs a file with all line breaks. 5 | */ 6 | 7 | #include 8 | 9 | void one_line(FILE *in, FILE *out) { 10 | char temp; 11 | while (fscanf(in, "%c", &temp) != -1) if (temp != '\n') fprintf(out, "%c", temp); 12 | return; 13 | } 14 | 15 | int main(int argc, char **argv) { 16 | if (argc != 3) { 17 | printf("Error: Invalid number of arguments!\n"); 18 | printf("Usage: one_lineifier.c \n"); 19 | return -1; 20 | } 21 | FILE *in = NULL; 22 | FILE *out = NULL; 23 | in = fopen(argv[1], "r"); 24 | if (in == NULL) { 25 | printf("Error: Input not available for reading!\n"); 26 | return -1; 27 | } 28 | out = fopen(argv[2], "w"); 29 | if (out == NULL) { 30 | printf("Error: Output not available for writing!\n"); 31 | fclose(in); 32 | in = NULL; 33 | return -1; 34 | } 35 | 36 | one_line(in, out); 37 | 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/python/semiprime.py: -------------------------------------------------------------------------------- 1 | t=int(input()) 2 | for i in range(t): 3 | x=0 4 | y=0 5 | N=int(input()) 6 | def checkP(n): 7 | c=0 8 | 9 | for i in range(2,(n//2)+1): 10 | if(n%i==0): 11 | c+=1 12 | break; 13 | if (c!=0): 14 | return 0 15 | return 1 16 | 17 | def checkSP(n): 18 | x=0 19 | y=0 20 | a=[] 21 | 22 | for i in range(2,(n//2)+1): 23 | if(n%i==0): 24 | a.append(i) 25 | if (len(a)==2): 26 | x=checkP(a[0]) 27 | y=checkP(a[1]) 28 | if(x==1 and y==1): 29 | return 1 30 | return 0 31 | x=0 32 | y=0 33 | 34 | for i in range(6,(N//2)+1): 35 | c=i 36 | d=N-i 37 | x=checkSP(c) 38 | y=checkSP(d) 39 | if(x==1 and y==1): 40 | print("YES") 41 | break; 42 | if(x!=1 or y!=1): 43 | print("NO") 44 | 45 | 46 | -------------------------------------------------------------------------------- /rust/maths/ngweihow_pythagoras.rs: -------------------------------------------------------------------------------- 1 | /** 2 | Simple Rust One Liner to calculate length of hypotenuse. 3 | 4 | Requires Cargo. 5 | @author: github.com/ngweihow 6 | */ 7 | 8 | use std::io; 9 | use std::f32; 10 | 11 | fn main() { 12 | 13 | // I gave up using an array/vector input lol. Rust is hard. 14 | println!("Enter the length of the adjacent and opposite to find out the length of the hypotenuse!"); 15 | println!("Adjacent: "); 16 | let mut input1 = String::new(); 17 | io::stdin().read_line(&mut input1) 18 | .expect("Failed to read line!"); 19 | 20 | let float1 = input1.trim().parse::().expect("Invalid Input!"); 21 | 22 | println!("Opposite: "); 23 | let mut input2 = String::new(); 24 | io::stdin().read_line(&mut input2) 25 | .expect("Failed to read line!"); 26 | 27 | let float2 = input2.trim().parse::().expect("Invalid Input!"); 28 | 29 | println!("The length of the hypotenuse is {} units!", length_hypotenuse(float1, float2)); 30 | } 31 | 32 | // Calculation function. 33 | fn length_hypotenuse(a: f32, b: f32) -> f32 { (a.powf(2.0) + b.powf(2.0)).sqrt() } -------------------------------------------------------------------------------- /honorary-one-line-wonders/README.md: -------------------------------------------------------------------------------- 1 | # What is this folder about? 2 | #### This folder stores honorary attempts as well as other short code snippets. 3 | #### This could include code that would otherwise be in one of the main language folders and is almost a "one-liner" but does not meet some criteria, such as using `;` instead of a new line. 4 | ---- 5 | ### What do I do if my intended "one-line" program gets moved here? 6 | No worries, you can still try to create a new file for your program "in one line" and submit another Pull Request for review. See https://github.com/kannagikazuko/one-line-wonders/blob/master/README.md for more information. 7 | 8 | ### Am I still eligible for a free shirt for Hacktoberfest if I end up contributing here? 9 | Yes! You just need to open 5 Pull Requests not flagged as spam! 10 | 11 | ### What do I do if a program gets moved here when it should not have? 12 | Open an issue! I or a repository collaborator, will look into it! Please provide supporting evidence as appropriate and an explanation of why that "one-line" program is the shortest number of lines for a runnable program in the language to exist. 13 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/cpp/anagram.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int anagram(char str1[], char str2[]) 6 | 7 | { 8 | 9 | int i, flag = 0, x[26] = {0}, y[26] = {0}; 10 | 11 | for(i = 0; str1[i] != '\0'; i++) 12 | 13 | x[str1[i] - 'a']++; 14 | 15 | for(i = 0; str2[i] != '\0'; i++) 16 | 17 | y[str2[i] - 'a']++; 18 | 19 | for (i = 0; i < 26; i++) 20 | 21 | { 22 | 23 | if (x[i] != y[i]) 24 | 25 | flag = 1; 26 | 27 | } 28 | 29 | if (flag == 1) 30 | 31 | cout << "Entered strings are not anagrams."; 32 | 33 | else 34 | 35 | cout << "Entered strings are anagrams."; 36 | 37 | } 38 | 39 | 40 | 41 | int main () 42 | 43 | { 44 | 45 | char str1[50], str2[50]; 46 | 47 | int flag; 48 | 49 | cout << "Enter string 1 : "; 50 | 51 | gets(str1); 52 | 53 | cout << "Enter string 2 : "; 54 | 55 | gets(str2); 56 | 57 | anagram(str1, str2); 58 | 59 | return 0; 60 | 61 | } 62 | -------------------------------------------------------------------------------- /python/BrunoGomesCoelho_ackermann_function.py: -------------------------------------------------------------------------------- 1 | ackermann = lambda m,n: n+1 if m == 0 else ackermann(m-1, 1) if (m > 0 and n == 0) else ackermann(m-1, ackermann(m, n-1)) 2 | 3 | print(ackermann(3, 3), "should be 61") 4 | 5 | # To test, just change the below to True. 6 | # Inputs and output taken from https://en.wikipedia.org/wiki/Ackermann_function 7 | test = False 8 | if test: 9 | # m = 0 10 | assert ackermann(0, 0) == 1 11 | assert ackermann(0, 1) == 2 12 | assert ackermann(0, 2) == 3 13 | assert ackermann(0, 3) == 4 14 | 15 | # m = 1 16 | assert ackermann(1, 0) == 2 17 | assert ackermann(1, 1) == 3 18 | assert ackermann(1, 2) == 4 19 | assert ackermann(1, 3) == 5 20 | 21 | # m = 2 22 | assert ackermann(2, 0) == 3 23 | assert ackermann(2, 1) == 5 24 | assert ackermann(2, 2) == 7 25 | assert ackermann(2, 3) == 9 26 | 27 | # m = 3 28 | assert ackermann(3, 0) == 5 29 | assert ackermann(3, 1) == 13 30 | assert ackermann(3, 2) == 29 31 | assert ackermann(3, 3) == 61 32 | assert ackermann(3, 4) == 125 33 | 34 | # m = 4 35 | assert ackermann(4, 0) == 13 36 | # From here on it reaches maximum recursion depth 37 | -------------------------------------------------------------------------------- /python/moonblade_luckBalance.py: -------------------------------------------------------------------------------- 1 | # solution to hackerrank question https://www.hackerrank.com/challenges/luck-balance/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=greedy-algorithms 2 | def luckBalance(k, contests): 3 | return reduce(lambda a, (i,b): a+b if i0 else 0))), 0) 4 | 5 | # test code 6 | contests = [[5, 1], [2, 1], [1, 1], [8, 1], [10, 0], [5, 0]] 7 | k = 3 8 | print(luckBalance(k, contests)) 9 | 10 | # explanation code 11 | # sort the constests such that all non important come first and then sort based on luck if important so that we can sum till allowed to lose and then subtract the sum of the rest 12 | sortedContests = sorted(contests, key= lambda x: (10000 - (x[1] * x[0])) if x[1]*x[0] >0 else 0) 13 | # Get only the first indices, ie luck values 14 | LuckArray = map(lambda x: x[0], sortedContests) 15 | # find number of lucks allowed in final array, it is the number of zero importance plus number of allowed failures 16 | allowed = len([x for x in contests if x[1]==0])+k 17 | # for each item in luck array, add to sum if it is before allowed index and remove from sum if it is after 18 | print(reduce(lambda a, (i,b): a+b if i 28 | #include 29 | #include 30 | using namespace std; 31 | 32 | int main(){ 33 | int n, temp; 34 | n=8; // Size of B 35 | int B[] = { 1,2,3,4,4,5,9,1}; 36 | set A; 37 | for(int i=0; i:: iterator it = A.begin(); 43 | for(; it!=A.end(); it++){ 44 | cout<<*it<<" "; 45 | } 46 | cout< usize { if n>1 { fib_recursive(n-1)+fib_recursive(n-2) } else { 1 } } 7 | fn fib_iterative(n: usize) -> usize { if n>1 { (2..=n).into_iter().fold((1,1) , |acc, _| (acc.1, acc.0+acc.1)).1 } else { 1 } } 8 | 9 | // Compile with rustc, run using the form "./Henning-K_fibonacci " 10 | fn main() { 11 | let n = usize::from_str(&env::args().nth(1).expect("Not enough arguments.")).expect("Positive integer expected."); 12 | println!("Fibonacci (iterative): {}", fib_iterative(n)); 13 | println!("Fibonacci (recursive): {}", fib_recursive(n)); 14 | } 15 | 16 | 17 | // Compile the test harness with rustc --test .rs, then execute the resulting binary 18 | #[test] 19 | fn test_normal_recursive() { 20 | assert_eq!(fib_recursive(0), 1); 21 | assert_eq!(fib_recursive(1), 1); 22 | assert_eq!(fib_recursive(2), 2); 23 | assert_eq!(fib_recursive(3), 3); 24 | assert_eq!(fib_recursive(4), 5); 25 | assert_eq!(fib_recursive(5), 8); 26 | } 27 | 28 | #[test] 29 | fn test_normal_iterative() { 30 | assert_eq!(fib_iterative(0), 1); 31 | assert_eq!(fib_iterative(1), 1); 32 | assert_eq!(fib_iterative(2), 2); 33 | assert_eq!(fib_iterative(3), 3); 34 | assert_eq!(fib_iterative(4), 5); 35 | assert_eq!(fib_iterative(5), 8); 36 | } 37 | -------------------------------------------------------------------------------- /python/valley/chrismclennon_countingValley-2.py: -------------------------------------------------------------------------------- 1 | count_valleys = lambda s: list(zip([0] + [sum([1 if x == 'U' else -1 for x in s[:e]]) for e in range(1, len(s))], [sum([1 if x == 'U' else -1 for x in s[:e]]) for e in range(1, len(s))])).count((0, -1)) 2 | 3 | 4 | assert count_valleys('UDDDUDUU') == 1 5 | assert count_valleys('UUDDDUDDUU') == 2 6 | assert count_valleys('DDUDUU') == 1 7 | assert count_valleys('UDUUUDUDDD') == 0 8 | assert count_valleys('DDUUDDUDUUUD') == 2 9 | assert count_valleys('DDDUUUUUDDDUUDUDDDUUDUUDDDUUDDDDDUDDUUDUDDUDUDDUDDDUDUUDUDUDDUDDDDDDDUUUUUUUUDUUDUUUUDUDDDUDDUUDUDDUDUDUUUUUUDUDDDDDDUDDDUUUDDUDDUDDUUUUDDDDUDUUUUUDUUDUDDUUUDUUUDDUDDDDUUUUDDDDDDUUUUDDDDUDDUUDDDDUUDUDDUUDUUUDUUUUDDUDDDDUUDUDDDDDUDUDUDUUDDUDUDDUDDDDUDUDUDUUUDDDDDUUUDDDUDDDUDDDDUDUDUDDUDDDDDDUDUDUDDDDDDUUUDDDUDUUDDDDUDUDDDDDUDDUUDUDDDDUDDDUUUUUDUDDUDUUDUDDDDUUUUDDDUDUUUUUUUDUUDDDUDUDDDDUDDUUDDDDDUDDUUUUDUUDUDDUDUUDDUUUDUUUUDDUUUUDDUUDUUUDUDUUUDUDDUDDDUDUUUUUUUUUUUDUDDUDDDDDUUDUDDUDDUDUDUUDDDDUUUDDUDDUDDUUDUUUDUDUUUUUDDUUDUUDUDDUDUUUUUUDDDDUUUDDUDUUUUUUUDDUUDDUUUUUDDUUDUUUDDUDUDUUDDDUDUUUUUUUDUUUUDDUDDDUDUUDUDDDUDUUUDUUUDDDUDDUUUUUDUUDDDDDDUUDDUDUDDUDUDUDDUDUDUUUDUDUUDUDUUDUDUDDDDUUUUDDDUUDUUDDUDUDUUDUDUUUDDUUUDUDUDDDUDDUUUDUDUUUDDUDUDUDDUUDDDDUUUUUDUDUUDUDUUDDDDUDDDUDUUUUUDDDUDDDDUUDDUUDUUUUUUDDUUDDUUUUUUUDUDDUDDDDDDDUDDDDUDUDUDUUDUDDDUDUUUUDDUUUDUDUDUUDDDDDUUUUUUDUDDUDUDDUDDUDUUDUDUUUUUDUDDDDUUUDDUUDDDUUUUDUDDDUDDUUUDDDDUDDDUDDDUUDDDDUUDDDUDDDUUUUUUDUDUUDUUDUDDDUDUUDDUDDDDUDUDUUUUUUUUUU') == 18 10 | 11 | -------------------------------------------------------------------------------- /groovy/valleys/piotrgajow_counting_valleys.groovy: -------------------------------------------------------------------------------- 1 | Closure countValleys = { String path -> (path as List).inject([level: 0, count: 0]) { acc, step -> step == 'U' ? [level: acc.level+1, count: acc.count] : [level: acc.level-1, count: acc.level == 0 ? acc.count + 1 : acc.count] }.count } 2 | 3 | assert countValleys('UDDDUDUU') == 1 4 | assert countValleys('UUDDDUDDUU') == 2 5 | assert countValleys('DDUDUU') == 1 6 | assert countValleys('UDUUUDUDDD') == 0 7 | assert countValleys('DDUUDDUDUUUD') == 2 8 | assert countValleys('DDDUUUUUDDDUUDUDDDUUDUUDDDUUDDDDDUDDUUDUDDUDUDDUDDDUDUUDUDUDDUDDDDDDDUUUUUUUUDUUDUUUUDUDDDUDDUUDUDDUDUDUUUUUUDUDDDDDDUDDDUUUDDUDDUDDUUUUDDDDUDUUUUUDUUDUDDUUUDUUUDDUDDDDUUUUDDDDDDUUUUDDDDUDDUUDDDDUUDUDDUUDUUUDUUUUDDUDDDDUUDUDDDDDUDUDUDUUDDUDUDDUDDDDUDUDUDUUUDDDDDUUUDDDUDDDUDDDDUDUDUDDUDDDDDDUDUDUDDDDDDUUUDDDUDUUDDDDUDUDDDDDUDDUUDUDDDDUDDDUUUUUDUDDUDUUDUDDDDUUUUDDDUDUUUUUUUDUUDDDUDUDDDDUDDUUDDDDDUDDUUUUDUUDUDDUDUUDDUUUDUUUUDDUUUUDDUUDUUUDUDUUUDUDDUDDDUDUUUUUUUUUUUDUDDUDDDDDUUDUDDUDDUDUDUUDDDDUUUDDUDDUDDUUDUUUDUDUUUUUDDUUDUUDUDDUDUUUUUUDDDDUUUDDUDUUUUUUUDDUUDDUUUUUDDUUDUUUDDUDUDUUDDDUDUUUUUUUDUUUUDDUDDDUDUUDUDDDUDUUUDUUUDDDUDDUUUUUDUUDDDDDDUUDDUDUDDUDUDUDDUDUDUUUDUDUUDUDUUDUDUDDDDUUUUDDDUUDUUDDUDUDUUDUDUUUDDUUUDUDUDDDUDDUUUDUDUUUDDUDUDUDDUUDDDDUUUUUDUDUUDUDUUDDDDUDDDUDUUUUUDDDUDDDDUUDDUUDUUUUUUDDUUDDUUUUUUUDUDDUDDDDDDDUDDDDUDUDUDUUDUDDDUDUUUUDDUUUDUDUDUUDDDDDUUUUUUDUDDUDUDDUDDUDUUDUDUUUUUDUDDDDUUUDDUUDDDUUUUDUDDDUDDUUUDDDDUDDDUDDDUUDDDDUUDDDUDDDUUUUUUDUDUUDUUDUDDDUDUUDDUDDDDUDUDUUUUUUUUUU') == 18 9 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/java/AnagramChecker.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | public class AnagramChecker 3 | { 4 | public static void main(String[] args) 5 | { 6 | Scanner input = new Scanner(System.in); 7 | System.out.println("First word?"); 8 | String word1 = input.next(); 9 | System.out.println("Second word?"); 10 | String word2 = input.next(); 11 | if(isAnagram(word1,word2)) 12 | System.out.println("true"); 13 | else 14 | System.out.println("false"); 15 | } 16 | public static boolean isAnagram(String s1, String s2) 17 | { 18 | ArrayList composition = new ArrayList(); 19 | ArrayList tally = new ArrayList(); 20 | contents(composition,tally,s1); 21 | ArrayList composition2 = new ArrayList(); 22 | ArrayList tally2 = new ArrayList(); 23 | contents(composition2,tally2,s2); 24 | for(int x=0; x a, ArrayList b, String s) 36 | { 37 | for(int x=0; x 4 | #endif 5 | 6 | #include 7 | #include 8 | 9 | 10 | /* Function declaration. */ 11 | int isPrime(long number, long iter); 12 | 13 | /* Main function body. */ 14 | #if !DEBUG 15 | int main(int argc, char *argv[]) 16 | #else 17 | int main(void) 18 | #endif 19 | { 20 | #if !DEBUG 21 | /* Using command line input. */ 22 | long numberToCheck = 0; 23 | 24 | if (argc < 2) /* First argument is the program name (argv[0]), which is "main". */ 25 | { 26 | printf("Not enough arguments.\n"); 27 | return 1; 28 | } 29 | 30 | /* Check if prime. */ 31 | if ( isPrime(atol(argv[1]), 1) ) /* atoi returns 0 if string is not a number. */ 32 | { 33 | printf("%s is a prime number.\n", argv[1]); 34 | } 35 | else 36 | { 37 | /* TODO: Add error messages for specific invalid input. Right now there is only a generic message for all errors. */ 38 | printf("%s is not a prime number\n", argv[1]); 39 | } 40 | 41 | return 0; 42 | #else 43 | /* For debugging. */ 44 | assert(!isPrime(-5, 1)); 45 | assert(!isPrime(-2, 1)); 46 | assert(!isPrime(-1, 1)); 47 | assert(!isPrime(1, 1)); 48 | assert( isPrime(2, 1)); 49 | assert( isPrime(3, 1)); 50 | assert( isPrime(5, 1)); 51 | assert(!isPrime(6, 1)); 52 | assert( isPrime(11, 1)); 53 | assert( isPrime(13, 1)); 54 | assert( isPrime(17, 1)); 55 | assert( isPrime(19, 1)); 56 | assert(!isPrime(20, 1)); 57 | #endif 58 | } /* End main. */ 59 | 60 | /* One-liner function definition. */ 61 | int isPrime(long number, long iter) 62 | { 63 | /* Super inneficient but fun! */ 64 | return (number<2) ? 0 : (iter*iter>number) ? 1 : !(number%iter) && iter>1 ? 0 : isPrime(number, iter+1); 65 | } /* End isPrime. */ -------------------------------------------------------------------------------- /honorary-one-line-wonders/cplusplus/yashagarwal1999_powerset.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #define endl "\n" 3 | #define pb push_back 4 | #define mp make_pair 5 | #define fi first 6 | #define se second 7 | #define MOD 1000000007 8 | #define MOD9 1000000009 9 | #define pi 3.1415926535 10 | #define ms(s, n) memset(s, n, sizeof(s)) 11 | #define prec(n) fixed<>= 1) {if (k & 1) r = r * n%p; n = n * n%p;} return r;} 30 | ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);} 31 | ll inv_euclid(ll a, ll m = MOD){ll m0 = m;ll y = 0, x = 1;if (m == 1)return 0;while (a > 1){ll q = a / m;ll t = m;m = a % m, a = t;t = y;y = x - q * y;x = t;}if (x < 0)x += m0;return x;} 32 | 33 | 34 | 35 | int main(){ 36 | 37 | 38 | ios_base::sync_with_stdio(false); 39 | cin.tie(0); 40 | cout.tie(0); 41 | vectorv; 42 | ll sum=0,act=0,k,n,q,f; 43 | cin>>n; 44 | v.reserve(n); 45 | forr(i,0,n) 46 | { 47 | cin>>f; 48 | v.pb(f); 49 | 50 | } 51 | ll x=(1LL<arr[x]; 53 | 54 | forr(i,1,x) 55 | { 56 | for(ll j=0;j0): 43 | while(len(a)!=1): 44 | for i in range(0,len(a)): 45 | d+=1 46 | if d==c: 47 | print(a) 48 | a=a[i+1:]+a[:i] 49 | d=0 50 | break 51 | var_1=a 52 | print(var_1) 53 | if var_1=='F': 54 | print(V+" is your Friend") 55 | elif var_1=='L': 56 | print(V+" is your LOVE") 57 | elif var_1=='A': 58 | print(V+" is your Attraction") 59 | elif var_1=='M': 60 | print(V+ " will marry you") 61 | elif var_1=='E': 62 | print(V+" is your Enemy") 63 | elif var_1=='S': 64 | print(V +" is your Sibling") 65 | elif count==0: 66 | print("No result found") 67 | print("Enter to exit or to run it once again enter any key !") 68 | c=input() 69 | 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # One Line Wonders ![](https://travis-ci.com/wzhouwzhou/one-line-wonders.svg?branch=master) 2 | A collection of one-line programs in various languages, performing various tasks. 3 | **"One-Line"** is for those languages that support it; the aim is to create a runnable file the shortest a language can allow (i.e. no using ; instead of a new line and "minifying" it to be one line). 4 | 5 | ### Why? 6 | Have some fun with coding every once in a while, and see how you can abuse the semantics of a language. 7 | 8 | ### Contributing 9 | Anyone can contribute to this repo by opening a PR, your contribution will be open-source on Github. Don't know what to make? Try coding something that logs "Hello, world!" to the console! 10 | 11 | ### Hacktoberfest 2021 12 | Celebrate [Hacktoberfest](https://hacktoberfest.digitalocean.com/) together with a diverse community of developers from around the world! 13 | 14 | ### PRs not marked as spam will be counted towards **4** PRs in the month of October for your **free Hacktoberfest T-Shirt!** 15 | 16 | ### Let's Get Started 17 | 1. Fork this repository 18 | - Click the Fork button in the top right of this page, then click on your profile image. 19 | 2. Clone to desktop `git clone https://github.com/your-username/one-line-wonders.git` 20 | 3. Checkout a branch `git checkout -b feature/branch-name` 21 | 4. Make yourself known 22 | - Add your bio to the CONTRIBUTORS.md file 23 | 24 | Name: [YOUR NAME](Github Link)
25 | Place: Where are you from?
26 | Coding Experience: Which programming languages do you know? What projects have you/do you worked on?
27 | Email: name@example.com
28 | 29 | 5. Add your one-line program's files of the form [username]_[filename], i.e., `wzhouwzhou_approximating_e.cc`. If a folder for your code's language does not exist, feel free to create it. 30 | 6. Commit and push `git add .; git commit -m "commit message"; git push origin branch-name;` 31 | 7. Create a new Pull Request from your fork 32 | - Click on the New Pull Request button located near the top of your repository. 33 | 8. Wait for your PR to be reviewed! 34 | 35 | **Star this repository if you had fun** :star::tada: 36 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/python/eapprox.py: -------------------------------------------------------------------------------- 1 | # 2 | # Approximating Euler's number correctly (Python) 3 | # 4 | # Copyright (c) 2014 Project Nayuki 5 | # All rights reserved. Contact Nayuki for licensing. 6 | # https://www.nayuki.io/page/approximating-eulers-number-correctly 7 | # 8 | 9 | import time 10 | from fractions import Fraction 11 | 12 | 13 | # Runs a demo that prints out some numbers 14 | def main(): 15 | # Print e rounded to n decimal places, for n from 0 to 60 16 | for i in range(61): 17 | print(compute_eulers_number(i)) 18 | print("") 19 | 20 | # Compute 1 to 3000 decimal places (exponentially increasing) and print timing 21 | prev = 0 22 | for i in range(71): 23 | digits = int(round(10 ** (i / 20.0))) 24 | if digits == prev: 25 | continue 26 | prev = digits 27 | 28 | start_time = time.time() 29 | compute_eulers_number(digits) 30 | elapsed_time = time.time() - start_time 31 | print("{:6d} {:7.3f} s".format(digits, elapsed_time)) 32 | 33 | 34 | # For example: compute_eulers_number(4) = "2.7183" 35 | def compute_eulers_number(accuracy): 36 | if accuracy < 0: 37 | raise ValueError() 38 | 39 | sum = Fraction(0) 40 | factorial = 1 41 | error_target = 10 ** accuracy 42 | scaler = Fraction(error_target) 43 | i = 0 44 | while True: 45 | term = Fraction(1, factorial) 46 | sum += term 47 | if i >= 1 and factorial > error_target: # i.e. term < 1/error_target 48 | lower = round_fraction(sum * scaler) 49 | upper = round_fraction((sum + term) * scaler) 50 | if lower == upper: 51 | # Note: The number of terms used is i+1 52 | s = str(lower) 53 | return s[ : len(s) - accuracy] + "." + s[len(s) - accuracy : ] 54 | i += 1 55 | factorial *= i 56 | 57 | 58 | HALF_FRACTION = Fraction(1, 2) 59 | 60 | # Any rounding mode works correctly with compute_eulers_number(). 61 | # Round-half-to-even is implemented here, but truncation, flooring, etc. are acceptable too. 62 | def round_fraction(num): 63 | result = num.numerator // num.denominator 64 | error = num - Fraction(result) 65 | if error > HALF_FRACTION or (error == HALF_FRACTION and result & 1 == 1): 66 | result += 1 67 | return result 68 | 69 | 70 | if __name__ == "__main__": 71 | main() 72 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ### Contribution Guidelines 2 | When contributing, please be sure to submit new files via a PR instead of editing someone else's. If you would like to request an edit from someone else, please open an issue and tag the contributor (check with git blame). 3 | 4 | # One line wonders 5 | A collection of one-line programs in various languages, performing various tasks. 6 | **"One-Line"** is for those languages that support it; the aim is to create a runnable file the shortest a language can allow (i.e. no using ; instead of a new line and "minifying" it to be one line). 7 | 8 | ### Why? 9 | Have some fun with coding every once in a while, and see how you can abuse the semantics of a language. 10 | 11 | ### Contributing 12 | Anyone can contribute to this repo by opening a PR, your contribution will be open-source on Github. Don't know what to make? Try coding something that logs "Hello, world!" to the console! 13 | 14 | ### Hacktoberfest 15 | Celebrate [Hacktoberfest](https://hacktoberfest.digitalocean.com/) together with a diverse community of developers from around the world! 16 | 17 | PRs marked as spam will not be counted towards 5 PRs in the month of October for your **free Hacktoberfest T-Shirt!** 18 | 19 | ### Let's Get Started 20 | 1. Fork this repository 21 | - Click the Fork button in the top right of this page, then click on your profile image. 22 | 2. Clone to desktop `git clone https://github.com/your-username/one-line-wonders.git` 23 | 3. Checkout a branch `git checkout -b feature/branch-name` 24 | 4. Make yourself known 25 | - Add your bio to the CONTRIBUTORS.md file 26 | 27 | Name: [YOUR NAME](Github Link)
28 | Place: Where are you from?
29 | Coding Experience: Which programming languages do you know? What projects have you/do you worked on?
30 | Email: name@example.com
31 | 32 | 5. Add your one-line program's files. If a folder for your code's language does not exist, feel free to create it. 33 | 6. Commit and push `git add .; git commit -m "commit message"; git push origin branch-name;` 34 | 7. Create a new Pull Request from your fork 35 | - Click on the New Pull Request button located near the top of your repository. 36 | 8. Wait for your PR to be reviewed! 37 | 38 | **Star this repository if you had fun** :star::tada: 39 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/cplusplus/mergeSort.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | void merge(int v[], int inicio, int curs, int fim){ 4 | //descoberta dos limites do array 5 | int tam_antes, tam_depois; 6 | tam_antes = curs - inicio +1; 7 | tam_depois = fim - curs; 8 | 9 | //alocacao de subvetores 10 | int *parte_antes, *parte_depois; 11 | parte_antes = new int[tam_antes]; 12 | parte_depois = new int[tam_depois]; 13 | 14 | //copia para subvetores 15 | for(int i = 0; i < tam_antes; i++){ 16 | parte_antes[i] = v[inicio +i]; 17 | } 18 | for(int i = 0; i < tam_depois; i++){ 19 | parte_depois[i] = v[curs +1 +i]; 20 | } 21 | 22 | //merge 23 | int ind_p1 = 0, ind_p2 = 0, sub_parte = inicio; 24 | while((ind_p1 < tam_antes) && (ind_p2 < tam_depois)){ 25 | if(parte_antes[ind_p1]<= parte_depois[ind_p2]){ 26 | v[sub_parte] = parte_antes[ind_p1]; 27 | ind_p1++; 28 | }else{ 29 | v[sub_parte] = parte_depois[ind_p2]; 30 | ind_p2++; 31 | } 32 | sub_parte++; 33 | } 34 | 35 | //união das sobras 36 | while(ind_p1 0){ 32 | HashMap hashMap = new HashMap (); 33 | int n = sc.nextInt();//number of nodes in the binary tree 34 | Node root=null; 35 | while (n > 1){ 36 | int parentValue = sc.nextInt();//parent node value 37 | int childValue = sc.nextInt();//new node value 38 | char leftOrRight = sc.next().charAt(0);//L or R to determine whether to insert the new node to the left(L) of right(R) 39 | Node parent = hashMap.get(parentValue); 40 | if (parent == null){ 41 | parent = new Node(parentValue); 42 | hashMap.put(parentValue, parent); 43 | if (root == null) 44 | root = parent; 45 | } 46 | Node child = new Node(childValue); 47 | if (leftOrRight == 'L') 48 | parent.left = child; 49 | else 50 | parent.right = child; 51 | hashMap.put(childValue, child); 52 | n--; 53 | } 54 | //Create an object of the class 55 | height_binary_tree obj = new height_binary_tree(); 56 | //Test the one line function 57 | System.out.println(obj.height(root)); 58 | t--; 59 | } 60 | } 61 | } 62 | 63 | 64 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/c/codetheorem_mergesort.c: -------------------------------------------------------------------------------- 1 | 2 | /* C program for Merge Sort */ 3 | #include 4 | #include 5 | 6 | // Merges two subarrays of arr[]. 7 | // First subarray is arr[l..m] 8 | // Second subarray is arr[m+1..r] 9 | void merge(int arr[], int l, int m, int r) 10 | { 11 | int i, j, k; 12 | int n1 = m - l + 1; 13 | int n2 = r - m; 14 | 15 | /* create temp arrays */ 16 | int L[n1], R[n2]; 17 | 18 | /* Copy data to temp arrays L[] and R[] */ 19 | for (i = 0; i < n1; i++) 20 | L[i] = arr[l + i]; 21 | for (j = 0; j < n2; j++) 22 | R[j] = arr[m + 1+ j]; 23 | 24 | /* Merge the temp arrays back into arr[l..r]*/ 25 | i = 0; // Initial index of first subarray 26 | j = 0; // Initial index of second subarray 27 | k = l; // Initial index of merged subarray 28 | while (i < n1 && j < n2) 29 | { 30 | if (L[i] <= R[j]) 31 | { 32 | arr[k] = L[i]; 33 | i++; 34 | } 35 | else 36 | { 37 | arr[k] = R[j]; 38 | j++; 39 | } 40 | k++; 41 | } 42 | 43 | /* Copy the remaining elements of L[], if there 44 | are any */ 45 | while (i < n1) 46 | { 47 | arr[k] = L[i]; 48 | i++; 49 | k++; 50 | } 51 | 52 | /* Copy the remaining elements of R[], if there 53 | are any */ 54 | while (j < n2) 55 | { 56 | arr[k] = R[j]; 57 | j++; 58 | k++; 59 | } 60 | } 61 | 62 | /* l is for left index and r is right index of the 63 | sub-array of arr to be sorted */ 64 | void mergeSort(int arr[], int l, int r) 65 | { 66 | if (l < r) 67 | { 68 | // Same as (l+r)/2, but avoids overflow for 69 | // large l and h 70 | int m = l+(r-l)/2; 71 | 72 | // Sort first and second halves 73 | mergeSort(arr, l, m); 74 | mergeSort(arr, m+1, r); 75 | 76 | merge(arr, l, m, r); 77 | } 78 | } 79 | 80 | /* UTILITY FUNCTIONS */ 81 | /* Function to print an array */ 82 | void printArray(int A[], int size) 83 | { 84 | int i; 85 | for (i=0; i < size; i++) 86 | printf("%d ", A[i]); 87 | printf("\n"); 88 | } 89 | 90 | /* Driver program to test above functions */ 91 | int main() 92 | { 93 | int arr[] = {12, 11, 13, 5, 6, 7}; 94 | int arr_size = sizeof(arr)/sizeof(arr[0]); 95 | 96 | printf("Given array is \n"); 97 | printArray(arr, arr_size); 98 | 99 | mergeSort(arr, 0, arr_size - 1); 100 | 101 | printf("\nSorted array is \n"); 102 | printArray(arr, arr_size); 103 | return 0; 104 | } 105 | -------------------------------------------------------------------------------- /_assemble/check.coffee: -------------------------------------------------------------------------------- 1 | do main = -> setImmediate -> 2 | easypathutil = require 'easypathutil' 3 | { sep, basename, dirname, relative: rel } = require 'path' 4 | 5 | replace = (str) -> str.replace /[|\\{}()[\]^$+*?.]/g, '\\$&' 6 | startsep = new RegExp "^#{replace sep}" 7 | base = easypathutil() 8 | ignored = ['.DS_Store$', '^_assemble', '^\\.git', '^\\.github', 'node_modules', '^_config\\.yml', '^\\.gitignore', '^CONTRIBUT[A-Z]+', '^LICENSE$', '^package', '^README', '^honorary-one-line-wonders', '^\\.travis'] 9 | 10 | list = base.$read_dir_sync.filter (e, i) -> !ignored.some (b) -> RegExp(b).test e.replace(base(), '').replace(startsep, '') 11 | 12 | languages = {} 13 | (if Reflect.has languages, language then ++languages[language] else Reflect.set languages, language, 1) for program in list when language = program.replace(base(), '').match(new RegExp "^#{escape sep}(\\w+)#{escape sep}")?[1] 14 | 15 | list.forEach (e, i) -> console.log "#{1 + i}. #{e}" 16 | console.dir languages 17 | console.log "#{bold}#{bgblack}This repository has #{bgred}#{Object.values(languages).reduce ((a, b) -> a + b), 0}#{bgblack} one-line programs in #{bgblue}#{Object.keys(languages).length}#{bgblack} languages" 18 | console.log "It also has #{bgblue}#{base['honorary-one-line-wonders'] 19 | .$read_dir_sync 20 | .filter((e, i) -> !ignored.some (b) -> e.replace(base['honorary-one-line-wonders'](), '').replace(startsep, '').startsWith b) 21 | .length}#{bgblack} honorary programs in /honorary-one-line-wonders\nNow running checks...#{r}" 22 | 23 | sorting = (for [path, program, folder] in list.map (e) -> [e, basename(e), dirname(e)] 24 | unless program.includes '_' 25 | console.log cyan, 'Filename must be of the format username_file_name_here.extension', r, red, rel('.', path), r 26 | program 27 | else 28 | Object.entries(categories).find (category) -> 29 | if category[1].test program.toLowerCase() #.includes category[0] 30 | if not folder.split(sep).some (f) -> category[1].test f 31 | console.log cyan, 'Expected program to be in a folder:', r, red, rel('.', path), category, r 32 | return true 33 | ).filter (e) -> e 34 | if sorting.length > 0 35 | console.log "#{bold}#{bgred}#{sorting.length} one-line programs were possibly misnamed or in the wrong directory. Please check the above output.#{r}" 36 | process.exit 1 37 | else 38 | console.log "#{bggreen}Folder checks passed!#{r}" 39 | 40 | r = '\x1b[0m' 41 | bold = '\x1b[1m' 42 | bgblue = '\x1b[44m' 43 | bgblack = '\x1b[40m' 44 | bgred = '\x1b[41m' 45 | bggreen = '\x1b[42m' 46 | cyan = '\x1b[36m' 47 | red = '\x1b[31m' 48 | 49 | categories = 50 | hello: /^hello([-_]?world)?$/i 51 | fib: /^fibo?(nacci)?/i 52 | palindrome: /^palindrome/i 53 | pi: /^approx(imate[_-]?)?pi/i 54 | prime: /prime/i 55 | sort: /sort/i 56 | anagram: /anagram/i 57 | caesar: /caesar/i 58 | e: /approx(imate[_-]?)?e/i 59 | golden_ratio: /(approx(imate[_-]?)?)?(golden_ratio|phi)/i 60 | valley: /valley/i 61 | unique_elems: /unique/i 62 | even: /even|odd/i 63 | reverse: /rev/i 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | # Logs 4 | logs 5 | *.log 6 | npm-debug.log* 7 | yarn-debug.log* 8 | yarn-error.log* 9 | 10 | # Runtime data 11 | pids 12 | *.pid 13 | *.seed 14 | *.pid.lock 15 | 16 | # Directory for instrumented libs generated by jscoverage/JSCover 17 | lib-cov 18 | 19 | # Coverage directory used by tools like istanbul 20 | coverage 21 | 22 | # nyc test coverage 23 | .nyc_output 24 | 25 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 26 | .grunt 27 | 28 | # Bower dependency directory (https://bower.io/) 29 | bower_components 30 | 31 | # node-waf configuration 32 | .lock-wscript 33 | 34 | # Compiled binary addons (https://nodejs.org/api/addons.html) 35 | build/Release 36 | 37 | # Dependency directories 38 | node_modules/ 39 | jspm_packages/ 40 | 41 | # TypeScript v1 declaration files 42 | typings/ 43 | 44 | # Optional npm cache directory 45 | .npm 46 | 47 | # Optional eslint cache 48 | .eslintcache 49 | 50 | # Optional REPL history 51 | .node_repl_history 52 | 53 | # Output of 'npm pack' 54 | *.tgz 55 | 56 | # Yarn Integrity file 57 | .yarn-integrity 58 | 59 | # dotenv environment variables file 60 | .env 61 | 62 | # next.js build output 63 | .next 64 | 65 | 66 | # Byte-compiled / optimized / DLL files 67 | __pycache__/ 68 | *.py[cod] 69 | *$py.class 70 | 71 | # C extensions 72 | *.so 73 | 74 | # Distribution / packaging 75 | .Python 76 | build/ 77 | develop-eggs/ 78 | dist/ 79 | downloads/ 80 | eggs/ 81 | .eggs/ 82 | lib/ 83 | lib64/ 84 | parts/ 85 | sdist/ 86 | var/ 87 | wheels/ 88 | *.egg-info/ 89 | .installed.cfg 90 | *.egg 91 | MANIFEST 92 | 93 | # PyInstaller 94 | # Usually these files are written by a python script from a template 95 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 96 | *.manifest 97 | *.spec 98 | 99 | # Installer logs 100 | pip-log.txt 101 | pip-delete-this-directory.txt 102 | 103 | # Unit test / coverage reports 104 | htmlcov/ 105 | .tox/ 106 | .coverage 107 | .coverage.* 108 | .cache 109 | nosetests.xml 110 | coverage.xml 111 | *.cover 112 | .hypothesis/ 113 | .pytest_cache/ 114 | 115 | # Translations 116 | *.mo 117 | *.pot 118 | 119 | # Django stuff: 120 | *.log 121 | local_settings.py 122 | db.sqlite3 123 | 124 | # Flask stuff: 125 | instance/ 126 | .webassets-cache 127 | 128 | # Scrapy stuff: 129 | .scrapy 130 | 131 | # Sphinx documentation 132 | docs/_build/ 133 | 134 | # PyBuilder 135 | target/ 136 | 137 | # Jupyter Notebook 138 | .ipynb_checkpoints 139 | 140 | # pyenv 141 | .python-version 142 | 143 | # celery beat schedule file 144 | celerybeat-schedule 145 | 146 | # SageMath parsed files 147 | *.sage.py 148 | 149 | # Environments 150 | .env 151 | .venv 152 | env/ 153 | venv/ 154 | ENV/ 155 | env.bak/ 156 | venv.bak/ 157 | 158 | # Spyder project settings 159 | .spyderproject 160 | .spyproject 161 | 162 | # Rope project settings 163 | .ropeproject 164 | 165 | # mkdocs documentation 166 | /site 167 | 168 | # mypy 169 | .mypy_cache/ 170 | 171 | dist 172 | dist-* 173 | cabal-dev 174 | *.o 175 | *.hi 176 | *.chi 177 | *.chs.h 178 | *.dyn_o 179 | *.dyn_hi 180 | .hpc 181 | .hsenv 182 | .cabal-sandbox/ 183 | cabal.sandbox.config 184 | *.prof 185 | *.aux 186 | *.hp 187 | *.eventlog 188 | .stack-work/ 189 | cabal.project.local 190 | cabal.project.local~ 191 | .HTF/ 192 | .ghc.environment.* 193 | 194 | # Java compiled classes 195 | *.class 196 | *.jar 197 | 198 | # Ruby 199 | .ruby-version 200 | 201 | 202 | # C 203 | # Prerequisites 204 | *.d 205 | 206 | # Object files 207 | *.o 208 | *.ko 209 | *.obj 210 | *.elf 211 | 212 | # Linker output 213 | *.ilk 214 | *.map 215 | *.exp 216 | 217 | # Precompiled Headers 218 | *.gch 219 | *.pch 220 | 221 | # Libraries 222 | *.lib 223 | *.a 224 | *.la 225 | *.lo 226 | 227 | # Shared objects (inc. Windows DLLs) 228 | *.dll 229 | *.so 230 | *.so.* 231 | *.dylib 232 | 233 | # Executables 234 | *.exe 235 | *.out 236 | *.app 237 | *.i*86 238 | *.x86_64 239 | *.hex 240 | 241 | # Debug files 242 | *.dSYM/ 243 | *.su 244 | *.idb 245 | *.pdb 246 | 247 | # Kernel Module Compile Results 248 | *.mod* 249 | *.cmd 250 | .tmp_versions/ 251 | modules.order 252 | Module.symvers 253 | Mkfile.old 254 | dkms.conf 255 | /.vs 256 | .Rproj.user 257 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/python/baseconversion_from_base_2_to_32.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | print("Today's Date and time is :", end=" ") 3 | print(str(datetime.datetime.now())) 4 | print("") 5 | print("------This program converts number with any base to the base entered by the User with guaranteed accuracy of minimum 3 decimal places.------") 6 | print(" Note: base should be less than or equal to 32 and greater than equal to 2 ") 7 | print("") 8 | print("**It rounds off the number upto 20th decimal places**") 9 | print("") 10 | tsssy="" 11 | while(tsssy==""): 12 | n=int(input("Enter base for the number")) 13 | print("") 14 | dic={'a':10,'b':11,'c':12,'d':13,'e':14,'f':15,'g':16,'h':17,'i':18,'j':19,'k':20,'l':21,'m':22,'n':23,'o':24,'p':25,'q':26,'r':27,'s':28,'t':29,'u':30,'v':31} 15 | rttu="" 16 | if n>10: 17 | xyzA=12 18 | while(xyzA>0): 19 | asd=[] 20 | akd=[] 21 | m=input("Enter Number with base "+str(n)).lower() 22 | print("") 23 | gg="".join(m) 24 | gg=gg.split(".") 25 | m=gg[0] 26 | xyz=0 27 | tty=0 28 | ks=0 29 | if len(gg)==2: 30 | for kjj in range(len(gg[1])): 31 | if 97<=ord(gg[1][kjj])<=122: 32 | u=gg[1][kjj] 33 | ks=dic[u] 34 | if int(ks)>=n: 35 | xyz=-1 36 | else: 37 | akd.append(str(ks)) 38 | else: 39 | akd.append(gg[1][kjj]) 40 | 41 | 42 | 43 | for i in range(len(m)): 44 | if 97<=ord(m[i])<=122: 45 | u=m[i] 46 | ks=dic[u] 47 | if int(ks)>=n: 48 | xyz=-1 49 | else: 50 | asd.append(str(ks)) 51 | else: 52 | asd.append(m[i]) 53 | if xyz==-1: 54 | xyzA=12 55 | print("Enter number again correctly, Make sure digits for the number should be less than the base of the number") 56 | else: 57 | xyzA=-9 58 | 59 | if n<=10: 60 | xyzA=12 61 | while(xyzA>0): 62 | asd=[] 63 | akd=[] 64 | m=input("Enter Number with base "+str(n)).lower() 65 | print("") 66 | gg="".join(m) 67 | gg=gg.split(".") 68 | m=gg[0] 69 | xyz=0 70 | ks=0 71 | if len(gg)==2: 72 | for kjj in range(len(gg[1])): 73 | ks=gg[1][kjj] 74 | if int(ks)>=n: 75 | xyz=-1 76 | 77 | else: 78 | akd.append(gg[1][kjj]) 79 | for i in range(len(m)): 80 | if int(m[i])>=n: 81 | xyz=-1 82 | else: 83 | asd.append(m[i]) 84 | if xyz==-1: 85 | xyzA=12 86 | print("Enter number again correctly, Make sure digits for the number should be less than the base of the number") 87 | else: 88 | xyzA=-9 89 | lm=int(input("Enter base to which you want to convert the given number")) 90 | print("") 91 | c=0 92 | d=0 93 | e=-1 94 | f=0 95 | t=1 96 | y="" 97 | if len(gg)==2: 98 | hj=1 99 | uu=1 100 | 101 | for ty in range(len(akd)): 102 | f+=int(akd[ty])*(n**e) 103 | e-=1 104 | 105 | while(hj<=20): 106 | uu=f*lm 107 | 108 | 109 | if int(uu)>=10: 110 | for i in range(97,119): 111 | if dic[chr(i)]==int(uu): 112 | rttu+=chr(i) 113 | if int(uu)<10: 114 | rttu+=str(int(uu)) 115 | f=uu-int(uu) 116 | hj+=1 117 | 118 | 119 | for i in range(len(asd)-1,-1,-1): 120 | c+=int(asd[i])*(n**d) 121 | d+=1 122 | 123 | while(t>0): 124 | ggg=c%lm 125 | if int(ggg)>=10: 126 | for iu in range(97,119): 127 | if dic[chr(iu)]==int(ggg): 128 | y+=chr(iu) 129 | if int(ggg)<10: 130 | y+=str(c%lm) 131 | c=c//lm 132 | if c==0: 133 | t=-1 134 | print("Number with base "+str(n)+" was "+".".join(gg)+" .Now it is converted into base "+str(lm)+" the required number is:",end=" ") 135 | print(y[::-1],end=".") 136 | if len(rttu)!=0: 137 | 138 | print(rttu) 139 | if len(rttu)==0: 140 | print(0) 141 | print("") 142 | uy=input("Press Enter to continue or hit any key to Exit !") 143 | 144 | 145 | 146 | -------------------------------------------------------------------------------- /honorary-one-line-wonders/python/tic-tac-toe.py: -------------------------------------------------------------------------------- 1 | import itertools 2 | import time 3 | hello_user_1=input("Your name --user_1") 4 | hello_user_2=input("your name --user_2") 5 | print("\t \t","Hello") 6 | print("*******You are playing Tic-tac-toe*******\n") 7 | print("\t\tCurrent Timing\n") 8 | localtime=time.asctime(time.localtime(time.time())) 9 | print("\t",localtime) 10 | 11 | 12 | #.........For malist_of_tuples_made_up_of_combinationsng permutations........# 13 | 14 | #....My board....# 15 | possibilities=["a1","a2","a3","b1","b2","b3","c1","c2","c3"] 16 | l_changer=["a1","a2","a3","b1","b2","b3","c1","c2","c3"] 17 | print("|"+l_changer[0]+"|"+l_changer[1]+"|"+l_changer[2]) 18 | print("----------") 19 | print("|"+l_changer[3]+"|"+l_changer[4]+"|"+l_changer[5]) 20 | print("----------") 21 | print("|"+l_changer[6]+"|"+l_changer[7]+"|"+l_changer[8]) 22 | #...Intialising y as 1...# 23 | y=1 24 | user_input_list=[] 25 | options_for_checkboard_x_or_o=["o","x"] 26 | while y==1: 27 | user_1=input("Choose 'x' or 'o'").lower() 28 | user_input_list.append(user_1) 29 | for ii in options_for_checkboard_x_or_o: 30 | if ii==user_1: 31 | y=999 32 | break 33 | else: 34 | y=1 35 | continue 36 | for i in user_input_list: 37 | if i=="x": 38 | user_2="o" 39 | else: 40 | user_2="x" 41 | print("\n",hello_user_1, "will play with",user_1,"\n") 42 | print("while" ,hello_user_2, "will play with ", user_2,"\n") 43 | n=0 44 | user_1_input_list=[] 45 | user_2_input_list=[] 46 | Total_combinations_List=[["a1","a2","a3"],["b1","b2","b3"],["c1","c2","c3"],["a1","b2","c3"],["c1","b2","a3"],["a1","b1","c1"],["a2","b2","c2"],["a3","b3","c3"]] 47 | list_of_tuples_made_up_of_combinations=[] 48 | for o in Total_combinations_List: 49 | z=tuple(o) 50 | list_of_tuples_made_up_of_combinations.append(z) 51 | y=1 52 | user_1_score=0 53 | user_2_score=0 54 | condition_to_run_loop="ee" 55 | nnnn=0 56 | 57 | while condition_to_run_loop!="": 58 | y=1 59 | possibilities=["a1","a2","a3","b1","b2","b3","c1","c2","c3"] 60 | user_1_input_list.clear() 61 | user_2_input_list.clear() 62 | l_changer=["a1","a2","a3","b1","b2","b3","c1","c2","c3"] 63 | print("|"+l_changer[0]+"|"+l_changer[1]+"|"+l_changer[2]) 64 | print("----------") 65 | print("|"+l_changer[3]+"|"+l_changer[4]+"|"+l_changer[5]) 66 | print("----------") 67 | print("|"+l_changer[6]+"|"+l_changer[7]+"|"+l_changer[8]) 68 | print("\n") 69 | 70 | while y==1: 71 | print(possibilities,"\n") 72 | print("Choose number from 1 to",len(possibilities),"to match the corresponding list") 73 | print(hello_user_1) 74 | uu=int(input("User_1 Enter an Integrr from above")) 75 | print("\n") 76 | index_actual_1=uu-1 77 | user_1_input_list.append(possibilities[index_actual_1]) 78 | pp=l_changer.index(possibilities[index_actual_1]) 79 | l_changer[pp]=user_1 80 | print("|"+l_changer[0]+"|"+l_changer[1]+"|"+l_changer[2]) 81 | print("----------") 82 | print("|"+l_changer[3]+"|"+l_changer[4]+"|"+l_changer[5]) 83 | print("----------") 84 | print("|"+l_changer[6]+"|"+l_changer[7]+"|"+l_changer[8]) 85 | print("\n") 86 | 87 | possibilities.remove(possibilities[index_actual_1]) 88 | combo=list(itertools.permutations(user_1_input_list,3)) 89 | for i in combo: 90 | for e in range(0,len(list_of_tuples_made_up_of_combinations)): 91 | if i==list_of_tuples_made_up_of_combinations[e]: 92 | print("yes") 93 | print("User_1 WON") 94 | user_1_score+=1 95 | y=3 96 | break 97 | else: 98 | pass 99 | if user_1_score==nnnn+1: 100 | break 101 | print(possibilities,"\n") 102 | print("Choose number from 1 to",len(possibilities),"to match the corresponding list") 103 | if len(possibilities)==0: 104 | print("\n","Game is draw","\n") 105 | break 106 | print(hello_user_2) 107 | vv=int(input("User_2 Enter an Integrr from above")) 108 | print("\n") 109 | index_actual_2=vv-1 110 | user_2_input_list.append(possibilities[index_actual_2]) 111 | ppq=l_changer.index(possibilities[index_actual_2]) 112 | l_changer[ppq]=user_2 113 | print("|"+l_changer[0]+"|"+l_changer[1]+"|"+l_changer[2]) 114 | print("----------") 115 | print("|"+l_changer[3]+"|"+l_changer[4]+"|"+l_changer[5]) 116 | print("----------") 117 | print("|"+l_changer[6]+"|"+l_changer[7]+"|"+l_changer[8]) 118 | print("\n") 119 | 120 | possibilities.remove(possibilities[index_actual_2]) 121 | fggg=list(itertools.permutations(user_2_input_list,3)) 122 | for tt in fggg: 123 | for et in range(0,len(list_of_tuples_made_up_of_combinations)): 124 | if tt==list_of_tuples_made_up_of_combinations[et]: 125 | print("yes","\n") 126 | print("user_2 WON","\n") 127 | user_2_score+=1 128 | y=3 129 | break 130 | else: 131 | pass 132 | print("user_1_score",user_1_score) 133 | print("user_2_score",user_2_score,"\n") 134 | nnnn+=1 135 | condition_to_run_loop=input("Enter any key to continue or press enter to quit") 136 | 137 | 138 | -------------------------------------------------------------------------------- /CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | Name: [William Zhou](https://github.com/wzhouwzhou)
2 | Place: White Plains, New York, USA
3 | Coding Experience: Developer, Systems Administrator, Designer, Chatbot Creator ([Chipsbot](https://chipsbot.me)), and More. Proficient: Node JS, Coffeescript; Front-End Javascript, HTML, CSS, Java, Python, C++
4 | Email: wzhouwzhou@gmail.com
5 | - Name: [Kazuko Kannagi](https://github.com/kannagikazuko)
6 | - Email: kannagikazuko@gmail.com
7 | 8 | Name: [Shawn Flores](https://github.com/Priultimus)
9 | Place: Ottawa, Ontario, Canada
10 | Coding Experience: Software Enginner, System Administrator, Software development in: Python, NodeJS, Java, HTML/CSS
11 | Email: shawnflores87@gmail.com
12 | 13 | Name: [Abigail Arias](https://github.com/bgail)
14 | Place: Salt Lake City, Utah, USA
15 | Coding Experience: Java, Python, Swift, Javascript, HTML, CSS. Worked on iOS Development, Flask, Angular 5+ and ReactJS.
16 | Email: mabigail1123@gmail.com
17 | 18 | Name: [Adeojo Emmanuel](https://github.com/adeojoemmanuel)
19 | Place: kwarastate , Nigeria
20 | Coding Experience: Java, Python, php, Javascript, HTML, CSS. Flask, Angular 2+.
21 | Email: emmanuel.adeojo.ibk@gmail.com
22 | 23 | Name: [Bilal Shehata](https://github.com/bshehata)
24 | Place: Melbourne, Australia
25 | Coding Experience: Software Engineer, Haskell, Java, C, Node, React, Python, Docker
26 | Email: bilalshehata@gmail.com
27 | 28 | Name: [Sebastian Racedo](https://github.com/JoaoRacedo)
29 | Place: Barranquilla, Atlantico, Colombia
30 | Coding Experience: Java, Python, R, MatLab, and More.
31 | Email: joao.racedo@gmail.com
32 | 33 | Name: [Shawn Seymour](https://github.com/devshawn)
34 | Place: Minneapolis, Minnesota, USA
35 | Coding Experience: Javascript, Node, React, Redux, Java, Groovy, Spring, Docker
36 | Email: shawn+hello@devshawn.com
37 | 38 | Name: [Earvin Gemenez](https://github.com/earvingemenez)
39 | Place: Davao City, Philippines
40 | Coding Experience: Python, Django, AngularJS, Elixir, Phoenix
41 | Email: earvin@swiftkind.com
42 | 43 | Name: [Tom Stein](https://github.com/ScholliYT)
44 | Place: Dülmen, Germany
45 | Coding Experience: Python, C#, Flutter, Arduino
46 | Email: tom@fantapptic.me
47 | 48 | Name: [Jacob Roush](https://github.com/jjroush)
49 | Place: Ames, Iowa
50 | Coding Experience: Javascript, PHP, Java
51 | Email: jacob@roush.io
52 | 53 | Name: [Anamay Saxena](https://github.com/saxenanamay)
54 | Place: Jaipur, Rajasthan, India
55 | Coding Experience: Javascript, PHP, C, C++
56 | Email: mannuanamaysaxena@gmail.com
57 | 58 | Name: [Veena Ghorakavi](https://github.com/vghorakavi)
59 | Place: United States of America (Moving to Canada)
60 | Coding Experience: C, C++, Java, Haskell, Python, Javascript, PowerShell, R
61 | Email: vghorakavi@gmail.com
62 | 63 | Name: [Yulius](https://github.com/yyoel)
64 | Place: Jakarta,Indonesia
65 | Coding Experience: C#, Javascript, Typescript, PowerShell,
66 | Email: yoelyulius@gmail.com
67 | 68 | Name: [Laisa Barros](https://github.com/lbarros00) 69 | Place: Sending PR from US 70 | Coding Experience: C, C++, React.js, JavaScript, HTML/CSS, Python 71 | 72 | Name: [Erick Surya Dinata](https://github.com/proesd)
73 | Place: Surabaya,Indonesia
74 | Coding Experience: PHP, Javascript, C++, Python
75 | Email: ericksuryadinata@gmail.com
76 | 77 | Name: [Nikola](https://github.com/vr1e)
78 | Place: Serbia
79 | Coding Experience: Javascript, Ruby on Rails
80 | Email: vrllee@gmail.com
81 | 82 | Name: [Sareesh Vattian](https://github.com/sareeshv)
83 | Place: CA, USA
84 | Coding Experience: Javascript, Angular, AngularJS, EmberJS
85 | Email: sareeshhere@gmail.com
86 | 87 | Name: [John Bramley](https://github.com/bramleyjl)
88 | Place: VA, USA
89 | Coding Experience: Javascript, PHP
90 | Email: bramleyjl@gmail.com
91 | 92 | Name: [Niral Pokal](https://github.com/niralpokal)
93 | Place: CA, USA
94 | Coding Experience: Javascript, Node.JS, Angular, AngularJS, React
95 | Email: niralpokal@live.com
96 | 97 | Name: [Austin Kregel](https://github.com/austinkregel)
98 | Place: MI, USA
99 | Coding Expereince: JavaScript/NodeJS, PHP, Python, Java, C#, C/C++
100 | Email: github@austinkregel.com
101 | 102 | Name: [Matt Sandy](https://github.com/MattSandy)
103 | Place: Minneapolis, MN
104 | Coding Experience: R, NodeJS, and PHP. Mostly work on reporting dashboards.
105 | Email: git@matt.mn
106 | 107 | Name: [Nils](https://github.com/Cyclenerd)
108 | Place: Hamburg, Germany
109 | Coding Experience: Perl
110 | Email: please-see@nkn-it.de
111 | 112 | Name: [Matt Chelen](https://github.com/mattchuranu)
113 | Place: SC, USA
114 | Coding Experience: Hobbyist programmer that has done work in ActionScript, C, GameMaker Language, Haxe, Java, JavaScript, Nim, Perl 6, and PHP.
115 | Email: matt@mattchuranu.xyz
116 | 117 | Name: [Jack Kavanagh](https://github.com/jackkav)
118 | Place: Amsterdam
119 | Coding Experience: Web developer(React), Hybrid mobile developer(React Native, Cordova)
120 | Programming Languages: Javascript and C#
121 | Email: git@matt.mn
122 | 123 | Name: [Armaan McLeod](https://github.com/OpticGenius)
124 | Place: Melbourne, Australia
125 | Coding Experience: Python, C, C#, Java and some web stuff
126 | Email: opticgenius@hotmail.com
127 | 128 | Name: [Çağatay Yücelen](https://github.com/cagatayyucelen)
129 | Place: Istanbul, Turkey
130 | Coding Experience: C, Go :heart_eyes:, Javascript, NodeJS, React Native, Embedded Systems(STM32)
131 | Email: cagatayyucelen@gmail.com
132 | 133 | Name: [Gabriel Fernandes](https://github.com/gafeol)
134 | Place: São Paulo, Brazil
135 | Coding Experience: C, C++, Java
136 | Email: gabriel5.oliveira@usp.br
137 | 138 | Name: [Ng Wei How](https://github.com/ngweihow)
139 | Place: Melbourne, Australia
140 | Coding Experience: Python, C, Java, JS, Web Dev frameworks
141 | Email: ngweihow.r@gmail.com
142 | 143 | Name: [Mohammed Nisham](https://github.com/moonblade)
144 | Place: Hyderabad, India
145 | Coding Experience: Python, CPP, Java, JS, MEAN stack, PHP, Angular
146 | Email: moonblade168@gmail.com
147 | 148 | Name: [Juan Pablo Huertas](https://github.com/JuanPabloHuertas)
149 | Place: Caquetá, Colombia
150 | Coding Experience: Java, Typescript, PHP, Ionic, Front-End Javascript, HTML, CSS
151 | Email: juanhuertas.dev@gmail.com
152 | 153 | Name: [Ante Barić](https://github.com/capJavert)
154 | Ante Barić, Croatia
155 | Coding Experience: Python <3 - JS -.-
156 | Email: javert@kickass.website
157 | 158 | Name: [Cole Hoffbauer](https://github.com/colehoff7)
159 | Place: Chicago, USA
160 | Coding Experience: Java, C++, Python, JS
161 | Email: cthrocks@comcast.net
162 | 163 | Name: [Albert Hofmann](https://github.com/JustCaptcha)
164 | Place: Russia
165 | Coding Expereince: Web Development(Vue, React), Java, C++, Nim, Crystal
166 | Email: higashi166@gmail.com
167 | 168 | Name: [Kennedy](https://github.com/kennedy)
169 | Place: NY, USA
170 | Coding Experience: Python, C#
171 | Email: kennedy@imap.cc
172 | 173 | Name: [Aman Agarwal](https://github.com/amanagarwal-sopho)
174 | Place: India
175 | Coding Experience: C, C++, Python
176 | Email: aman.agarwal97@gmail.com
177 | 178 | Name: [Bruno Gomes Coelho](https://github.com/BrunoGomesCoelho)
179 | Place: Brazil
180 | Coding Experience: C, Java, Python
181 | Email: rather not :)
182 | 183 | Name: [Kyle Hu](https://github.com/falafel72)
184 | Place: CA, USA (Hong Kong originally)
185 | Coding Experience: C/C++, Python, Java, Javascript
186 | Email: kylehu2000@gmail.com
187 | 188 | Name: [David Chen M.](https://github.com/dchenmei)
189 | Place: NY, USA
190 | Coding Experience: C++, Python, Scheme (!)
191 | Email: lastname#2lastname#1firstname@gmail.com
192 | 193 | Name: [Ricardo VC](https://github.com/Include-Poetry)
194 | Place: México
195 | Coding Experience: C/C++, Javascript, Liquid, Front-end development stuff
196 | Email: rivel_co@include-poetry.com
197 | 198 | Name: [Piotr Gajowniczek](https://github.com/piotrgajow)
199 | Place: Lodz, Poland
200 | Coding Experience: Groovy, Java, TypeScript, JavaScript, SQL
201 | Email: piotrgajow@gmail.com
202 | 203 | Name: [Sourabh Lal](https://github.com/sourabhlal)
204 | Place: Lausanne, Switzerland
205 | Coding Experience: Python, Java, JavaScript
206 | Email: sourabh@sourabhs.space
207 | 208 | Name: Neo Anoman
209 | Place: New Delhi,India
210 | Coding Experiance : Python,c++,c,HTML
211 | Email: neoanoman@gmail.com 212 | 213 | Name: Shane Creedon
214 | Place: Dublin, Ireland
215 | Coding Experience: Python, Java, HTML, CSS, JS, Angular, Django, Spring 216 | Email: Shane.creedon3@mail.dcu.ie 217 | 218 | Name: Kevin Blicharski
219 | Place: Iowa City, Iowa
220 | Coding Experience: Python, Java, C++, HTML, CSS, JavaScript, TypeScript, F#, Ruby, React Native, Angular, Django, Rails
221 | Email: blicharskikevin@gmail.com
222 | 223 | Name: Kyrpa Jorik Loh
224 | Place: Liubartsi
225 | Coding Experience: Python, Java, JavaScript, Go
226 | Email: kyrpa@jorik.loh
227 | 228 | Name: Eesh Tyagi
229 | Place: Bangalore, India
230 | Coding Experience: Javascript, React, PWA 231 | Email: eesh.tyagi@gmail.com 232 | 233 | Name: [Jorge Pinto](https://github.com/spikejap)
234 | Place: Porto, Portugal
235 | Coding Experience: C#, Java
236 | Email: not now
237 | 238 | Name: Govind Venugopalan
239 | Place: Singapore 240 | Coding Experience: Python, Java, C++ 241 | Email: govindvenugopalan@gmail.com 242 | 243 | Name: [Dhruv Sahnan](https://github.com/dhruvsahnan1008)
244 | Place: Delhi, India
245 | Coding Experience: Python, C++
246 | Email: dhruv.ds.009@gmail.com 247 | 248 | Name: Ankur Sonawane
249 | Place: Varanasi, India 250 | Coding Experience:Python, C, CPP 251 | Email: sankur.shrikant.eee16@itbhu.ac.in 252 | 253 | Name: [Rafael De Luna](https://github.com/RDLL)
254 | Place: México
255 | Coding experience: html, java, c
256 | Email rafael24b00@hotmail.com
257 | 258 | Name: [Malik Ahmed](https://github.com/animanmaster)
259 | Place: New Jersey 260 | Coding Experience: Ruby, Java, Python, C, C++, C#, Javascript 261 | 262 | Name: [Ian Emnace](https://github.com/igemnace)
263 | Place: Quezon City, Philippines
264 | Coding Experience: Software development in Javascript, in browser and with Node.js. Projects in React/React Native, Vue. Toolbox primarily includes Vim scripts, Unix shell, and miscellaneous Python/Perl/Ruby programs.
265 | Email: igemnace@gmail.com
266 | 267 | Name: [Matan Kotler-Berkowitz](https://github.com/matankb)
268 | Place: Massachusetts, USA
269 | Coding Experience: JavaScript, HTML, CSS, Java, OCaml
270 | Email: 205matan@gmail.com
271 | 272 | Name: Ed Griebel
273 | Place: New York, USA
274 | Coding Experience: Java, JavaScript, C, C++, Python, SQL, ...
275 | Email: edgriebel@gmail.com 276 | 277 | Name: [João Portela](https://github.com/joaoportela) 278 | Place: Porto, Portugal 279 | Coding Experience: C#, C, C++, Python, SQL, ... 280 | 281 | Name: [Adam Hill](https://github.com/cadarn)
282 | Place: London, UK 283 | Coding Experience: Python, IDL, SQL, HTML, C++ 284 | 285 | Name: [Ramiro Batista da Luz](https://github.com/ramiroluz)
286 | Place: Curitiba, PR, Brazil
287 | Coding Experience: Python
288 | Email: ramiroluz@gmail.com
289 | 290 | Name: [Jibin K Mathew](https://github.com/jibinkmathew94)
291 | Place: Kerala, India
292 | Coding Experience: Python,Javascript,HTML,CSS
293 | Email: jibin.mathew94@gmail.com
294 | 295 | Name: [Vlad Nikityuk](https://github.com/rk4n)
296 | Place: Kyiv, Ukraine
297 | Coding Experience: Python, C#, JS, ...
298 | 299 | Name: [Isak Rabin](https://leetcode.com/sgirabin/) 300 | Place: Singapore, SG 301 | Coding Experience: Java 302 | Email: isak_r@yahoo.com 303 | 304 | Name: [Geoff Safcik](https://github.com/gsafcik)
305 | Place: Denver, Colorado, USA
306 | Coding Experience: Python, PHP, SQL/MySQL, JavaScript, etc
307 | Email: gsafcik@gmail.com
308 | 309 | Name: Akashdeep Arora
310 | (akashdeep98.github.io) 311 | Place: India 312 | Coding Experience:Python, C, CPP,HTML,CSS, JAVASCRIPT, BOOTSTRAP 313 | Email: akashdeeparora2@gmail.com 314 | 315 | Name: [Jane Liu](https://github.com/JaneLiuUSA/)
316 | Place: Cleveland, OH, USA (from Taiwan originally)
317 | Coding Experience: Python, Java, Django, Google Web Toolkit, HTML
318 | Email: janeliuUSA@gmail.com
319 | 320 | Name: [Beatriz Harumi Uezu](https://github.com/beatrizuezu)
321 | Place: São Paulo, SP, Brazil
322 | Coding Experience: Python
323 | Email: beatriz.uezu@gmail.com
324 | 325 | Name: [Hugo Nunes](https://github.com/hugonun)
326 | Place: Luxembourg
327 | Coding Experience: Hobbyist programmer. Python, PHP, JavaScript, HTML/CSS
328 | 329 | Name: Nitish Chauhan
330 | Place: India 331 | Coding Experience:Python 332 | Email: maths.boring@gmail.com 333 | 334 | Name: [Bhirawa Mbani](https://github.com/bhirmbani)
335 | Place: Jakarta, Indonesia
336 | Coding Experience: Javascript
337 | Email: bhirmbani@gmail.com
338 | 339 | Name: [Jasper Chen](https://github.com/jasperdchen/) 340 | Place: Irvine, CA 341 | Coding Experience: JavaScript 342 | Email: jasperdchen@gmail.com 343 | 344 | Name: [Adithya Narasinghe](https://github.com/nmasnadithya)
345 | Place: Colombo, Sri Lanka
346 | Coding Experience: Swift, Java, Kotlin, Typescript, Javascript, C#, C++, CSS, HTML
347 | Email: adithyasnarasinghe@gmail.com
348 | 349 | Name: [Riei Joaquim](https://github.com/Riei-Joaquim)
350 | Place: Recife, PE, Brazil
351 | Coding Experience: C/C++ and Python
352 | Email: rjmr@cin.ufpe.br
353 | 354 | Name: [ivanightingale](https://github.com/ivanightingale)
355 | Place: Shenzhen, China
356 | Coding Experience: Data Engineer. Favorite language is Scala.
357 | Email: N/A
358 | 359 | Name: [Antonio](https://github.com/Antonio32A/)
360 | Place: Croatia
361 | Coding Experience: Discord Bot Developer (Python). Programming Languages: Python and C.
362 | Email: antonio32a.1337@gmail.com
363 | 364 | Name: [BenjaminUrquhart](https://github.com/BenjaminUrquhart)
365 | Coding Experience: Discord Bot Developer (Java) + misc. wrappers.
366 | Programming Languages: Python 2/3, Java 8
367 | Email: benjamin@ericsart.com 368 | 369 | Name: [Shubham Patil](https://github.com/shubhamdpatil) 370 | Place: Pune, India 371 | Coding Experience: C, python 372 | Email: shubhampatil.patil@gmail.com 373 | 374 | Name: [Lizard Morrow] (https://github.com/onlyasmalllizard)
375 | Place: UK
376 | Coding Experience: Ruby, Python, C, HTML/CSS
377 | 378 | Name: [UsmanAkinbiyi](https://github.com/ThaLeprechaun)
379 | Place: Lagos, Nigeria
380 | Coding Experience: Javascript and python
381 | Email: oakinbiyiusman@gmail.com
382 | 383 | Name: [Ojaswy Akella](https://github.com/Ojaswy)
384 | Place: Hyderabad, India
385 | Coding Experience: Data Scientist, Competetive Coder, HTML, CSS, Javascript, Java, Python, C, R, MATLAB
386 | Portfolio: [Here](https://ojaswy.github.io)
387 | 388 | Name: [Jaako Andes](https://github.com/jaakofalltrade)
389 | Place: Sorsogon City, Philippines
390 | Coding Experience: React JS, Node JS, Javascript, jQuery, C and Python. Junior Web Developer.
391 | Email: jaako.andes@bicol-u.edu.ph
392 | 393 | Name: [BrianHopper](https://github.com/BubbaBeans)
394 | Place: Redding, California, USA 395 | Coding Experience: Hobbyist programmer, various languages since 1982.
396 | Programming Languages: Some C++, some Python 2/3, VB.net... anyone remember Pilot? 397 | Email: brian.hopper@transdev.com 398 | 399 | Name [Henning-K](https://github.com/Henning-K)
400 | Place: Germany 401 | Coding Experience: Hobbyist, Rust, Python3, one cargo submodule
402 | Programming Languages: Rust, Python 3, Java, Javascript
403 | Email: N/A 404 | 405 | Name: [Ben Carpenter](https://github.com/jagwiredev/)
406 | Place: Australia
407 | Coding Experience: Computer Science Student. Programming Languages: C++ and Full-Stack Web Development.
408 | Email: benwcarpenter0@gmail.com
409 | 410 | Name: [N Balgopal Patro](https://github.com/balgopal123)
411 | Place: Berhampur , Odisha , India
412 | Coding Experience: Javascript, HTML, CSS, Java, Python, C++ ,C ,Firebase ,Android
413 | Email: n.balgopalpatra@gmail.com
414 | 415 | Name: [icedream](https://github.com/icedream)
416 | Coding Experience: Writing IRC bots, web apps, network utilities, Docker stacks, pipelines for Jenkins/GitLab CI and shell scripts.
417 | Programming Languages: Go, JavaScript, TypeScript, CoffeeScript, IcedCoffeeScript, C#, VB.NET, Bash, (CSS, HTML)
418 | Email: icedream@icedream.pw
419 | 420 | Name: [Thanapat Bhunnachet](https://github.com/tnptop)
421 | Place: Thailand
422 | Coding Experience: Software Engineer, mostly work on web technologies (JavaScript, Node.js, Python)
423 | Email: me@tnptop.com 424 | 425 | Name: [Subham Sahu](https://github.com/subhamX/)
426 | Coding Experience: Full Stack Web Developer
427 | Programming Languages: C++ 1/2, Python 1/2, JavaScript 3/4
428 | Email: subham.iitrpr@gmail.com 429 | 430 | Name: [Jurica](https://github.com/juricav)
431 | Coding Experience: Dynamics365 developer
432 | 433 | Name: [pbootly](https://github.com/pbootly)
434 | Place: Southampton, United Kingdom
435 | Coding Experience: System administrator. Bash, Node and some C.
436 | Email: mthomas@polybit.io
437 | 438 | Name: [Ankita Priya](https://github.com/AnkitaBIT)
439 | Place: India
440 | Coding Experience: A newbie in this felid. Programming Languages: C, HTML and Python.
441 | Email: ankitapriya2011@gmail.com
442 | 443 | Name: [Antonio](https://github.com/toluwalope19)
444 | Place: Nigeria
445 | Coding Experience: Python and javaScript.
446 | Email: tolubarca01@gmail.com
447 | 448 | Name: [Roger Seekell](https://github.com/rpstester)
449 | Place: Earth
450 | Coding Experience: C++, C#, Java, PowerShell
451 | Email: rogerseek1@gmail.com
452 | 453 | Name: [Abhay yadav](https://github.com/predator21x)
454 | place: India.
455 | Coding Experience: a newbie in this field. Programming language: C, python.
456 | Email: ry694356@gmail.com
457 | 458 | Name: [Abhishek Singh](https://github.com/n6wbi6)
459 | Place: India
460 | Coding Experience: C and python.
461 | Email: abhisheksingh.g07@gmail.com
462 | 463 | Name: [Isak Rabin](https://github.com/sgirabin) 464 | Place: Singapore 465 | Coding Experience: Java 466 | Email: isak_r@yahoo.com 467 | 468 | Name: [Zombie Chibi XD](https://github.com/ZombieChibiXD)
469 | Place: Bali, Indonesia
470 | Field Experience: System Administrator, Junior web developer, beta-tester, and debugger
471 | Coding Experience: 3 years of learning & coding experience in C++, Java, Javascript/NodeJS, PHP, Vue.js, Laravel Framework, GoLang and python.
472 | Email: chibisd10@gmail.com
473 | 474 | Name: [Oyvind Nilsen](https://github.com/turbosnute)
475 | Place: Trondheim, Norway
476 | Field Experience: System Admin
477 | Coding Experience: 10 years of Powershell scripting. Also some experience with Java, Js, PHP, Python and C#.
478 | Email: oyvind.nilsen@gmail.com
479 | 480 | Name: [Jay](https://github.com/TacticalTechJay)
481 | Place: Milky Way Galaxy
482 | Coding Experience: Semi-noob in JS.
483 | Email: tacticaltechjay@gmail.com
484 | 485 | Name: [David](https://github.com/Xander1233)
486 | Place: Frankfurt, Germany
487 | Coding Experience: TS, JS/NodeJS, Java, C, C++, C#, Assembly, React 488 | Email: david.neidhart@gmx.net
489 | 490 | Name: [antoooks](https://github.com/antoooks)
491 | Place: Indonesia / Singapore
492 | Coding Experience: JS, TS, PHP, Java, Go. Specialize in CI/CD, Cloud Architecture, and Automation. 493 | Email: antokurnianto82@gmail.com
494 | --------------------------------------------------------------------------------