This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Data.Bits (Bits (testBit), FiniteBits(countLeadingZeros, finiteBitSize)) | |
| import Data.Char (intToDigit) | |
| toBinary :: FiniteBits a => a -> [Char] | |
| toBinary n = [charOfBitAt i n | i <- reverse [0..(bitLength n - 1)]] | |
| where | |
| bitLength = (-) <$> finiteBitSize <*> countLeadingZeros | |
| charOfBitAt i = intToDigit . fromEnum . flip testBit i |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; style 1 | |
| (let [console (System/console) | |
| password-char-array (.readPassword console "Password (hidden): " (to-array ())) | |
| password (String. password-char-array) | |
| quoted (fn [s] (str \' s \'))] | |
| (println (quoted password))) | |
| ;; style 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var style = document.createElement('style'); | |
| style.innerHTML = 'html::-webkit-scrollbar { display: none; }'; | |
| document.head.appendChild(style); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <linux/if_packet.h> | |
| #include <net/if.h> | |
| #include <netdb.h> | |
| #include <sys/socket.h> | |
| #include <sys/types.h> | |
| #include <ifaddrs.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| int |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt | |
| // https://source.chromium.org/chromium/chromium/src/+/main:base/win/scoped_com_initializer.h | |
| // https://source.chromium.org/chromium/chromium/src/+/main:base/win/scoped_bstr.h | |
| // https://source.chromium.org/chromium/chromium/src/+/main:chrome/services/util_win/av_products.cc (FillAntiVirusProductsFromWSC) | |
| // C | |
| #include <cassert> | |
| #include <clocale> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| | path sep dirs | | |
| sep := (Smalltalk os isWindows) ifTrue: [ $; ] ifFalse: [ $: ]. | |
| path := Smalltalk os environment at: 'path'. | |
| dirs := sep split: path. | |
| dirs reject: [ :each | File exists: each ]. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # the uninstall script corresponding to the install script here: | |
| # https://clojure.org/guides/install_clojure#_linux_instructions | |
| set -e | |
| prefix_dir=/usr/local | |
| rm -rfv $prefix_dir/lib/clojure |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // please link with "runtimeobject.lib" | |
| #include <roapi.h> | |
| #include <winstring.h> | |
| #include <windows.foundation.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Puzzle = struct | |
| let (+) a b = | |
| let rec work accum base remain = | |
| if remain = 0 | |
| then accum | |
| else work | |
| (Int.add accum (remain mod b * base)) | |
| (base * 10) | |
| (remain / b) | |
| in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <random> | |
| #include <string> | |
| std::string get_random_string(size_t n) | |
| { | |
| std::random_device device; | |
| std::default_random_engine::result_type seed = device(); | |
| std::default_random_engine engine(seed); | |
| std::uniform_int_distribution<int> distribution('a', 'z'); |