Instantly share code, notes, and snippets.

🐼

# Dionysis Zindrosdionyziz

🐼
• Sort options
Last active Nov 21, 2019
View blur.cpp
 #include #include #include using namespace std; struct RGBA { int a, r, g, b; }; const int bytes_per_row = 4;
Created Nov 19, 2019
 diff --git a/construction.tex b/construction.tex index 79aa218..babee01 100644 --- a/construction.tex +++ b/construction.tex @@ -144,11 +144,18 @@ We will now show that the savings from the interlink set technique are significa We can split it up at some arbitrary index $k \geq 0$: - \begin{align*} - \sum_{j=0}^\infty (2^{-i})^j &= \sum_{j=0}^k 2^{-ij} + \sum_{j=k+1}^\infty (2^{-i})^j\\
Created Oct 21, 2019
View missing-number.cpp
 #include using namespace std; int main() { const int N = 10; int numbers[] = {0, 2, 1, 3, 10, 4, 6, 7, 8, 5}; int answer = 0; for (int bit = 0; (1 << bit) <= N; ++bit) {
Created Aug 14, 2019
View lis.py
 def longest_increasing_subsequence(sequence): best_length = -1 for bitmask in range(2**len(sequence)): subsequence = [] for bit_idx in range(len(sequence)): if bitmask & (1 << bit_idx): subsequence.append(sequence[bit_idx]) if not sorted(subsequence) == subsequence: continue if len(subsequence) > best_length:
Created Jul 9, 2019
View gist:5b7e134279f692cbdd56701f0f0546e4
 { "compilerOptions": { /* Basic Options */ "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ "lib": ["es2016", "DOM"], /* Specify library files to be included in the compilation. */ "resolveJsonModule": true, /* Allows for importing, extracting types from and generating .json files. // "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
Created May 1, 2019
View judge-chai.js
 const chai = require('chai') const chaiAsPromised = require('chai-as-promised') async judge() { expect(tx.isSane(), 'TX not sane') .to.be.true expect(tx.inputs.length, 'TX doesn\'t have 1 input') .to.equal(1) expect(tx.outputs[0].value, TX doesn't pay \${SATOSHI_VALUE / SATOSHIS_IN_BTC} BTC) .to.equal(SATOSHI_VALUE)
Created Apr 28, 2019
View gist:623dbeb6cc28126d4908d3449a9d0e3f
 23.hs:23:3: error: • Couldn't match type ‘a’ with ‘a0’ ‘a’ is a rigid type variable bound by the type signature for: rnd_select :: forall a. [a] -> Int -> IO [a] at 23.hs:18:1-34 Expected type: IO [a] Actual type: IO [a0] • In a stmt of a 'do' block: return choice In the expression:
Created Apr 28, 2019
View removeat.hs
 module RemoveAt where removeAt :: Int -> [a] -> (a, [a]) removeAt n xs = (item, list) where item = xs!!(n - 1) list = map snd (filter fst (zip characteristic xs)) characteristic = before ++ pivot ++ after before = replicate (n - 1) True pivot = [False]
Created Apr 28, 2019
View 23.hs
 import Control.Monad.State.Lazy import System.Random import RemoveAt choose = do (gen, xs) <- get let (idx, gen') = randomR (1, length xs) gen let (val, xs') = removeAt idx xs put (gen', xs') return val
Created Apr 27, 2019
View parallel-opportunities.js
 wallet class Edge { order: { placed: false, place: async function() { ... this.placed = true orderid = await cctx.placeOrder() do {
You can’t perform that action at this time.