This file contains 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
from concurrent.futures import ProcessPoolExecutor, wait | |
from multiprocessing import Manager | |
from argparse import ArgumentParser | |
from concurrent.futures import Future | |
from typing import List, Dict | |
import fastparquet | |
import os | |
import pandas as pd | |
import numpy as np |
This file contains 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
{ | |
// Use IntelliSense to learn about possible attributes. | |
// Hover to view descriptions of existing attributes. | |
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "dumb_agent", | |
"type": "python", | |
"request": "launch", |
This file contains 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 {Injectable, Inject, Optional} from '@angular/core'; | |
import { | |
HttpInterceptor, | |
HttpHandler, | |
HttpRequest, | |
HttpHeaders, | |
HttpResponse, | |
HttpErrorResponse | |
} from '@angular/common/http'; | |
import {Request} from 'express'; |
This file contains 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
set nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" alternatively, pass a path where Vundle should install plugins | |
"call vundle#begin('~/some/path/here') | |
" let Vundle manage Vundle, required |
This file contains 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
iex(14)> ring = HashRing.new() |> HashRing.add_node(:a) |> HashRing.add_node(:b) | |
#<Ring[:a, :b]> | |
iex(15)> [:foo, :bar, :baz, :flop] |> Enum.each(fn(k) -> IO.puts(HashRing.key_to_node(ring, k)) end) | |
b | |
b | |
b | |
a | |
:ok | |
iex(16)> ring = HashRing.add_node(ring, :c) | |
#<Ring[:a, :c, :b]> |
This file contains 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://www.geeksforgeeks.org/check-if-a-given-number-is-sparse-or-not/ | |
/* | |
* check_sparse.c | |
* | |
* Created on: Aug 2, 2018 | |
* Author: sikanrong | |
*/ | |
This file contains 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://www.geeksforgeeks.org/rotate-bits-of-an-integer/ | |
/* | |
* rotate_bits.c | |
* | |
* Created on: Aug 2, 2018 | |
* Author: sikanrong | |
*/ | |
#include <stdio.h> |
This file contains 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://www.geeksforgeeks.org/calculate-square-of-a-number-without-using-and-pow/ | |
//Calculate a number's square without using /, *, or pow(). | |
#include <stdio.h> | |
int main(){ | |
int n; | |
printf("Please enter an integer: "); |
This file contains 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
//Smallest power of 2 greater than or equal to n | |
//https://www.geeksforgeeks.org/smallest-power-of-2-greater-than-or-equal-to-n/ | |
var smallestPowerOfTwo = function(x){ | |
var bitPlaces = 0; | |
while(x){ | |
bitPlaces++; | |
x >>= 1; | |
} | |
return 1 << bitPlaces; |
This file contains 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
//Bitwise programming interview question | |
var isPowerOfFour = function(x){ | |
var bitIdx = 0; | |
var currentIdx = 0; | |
var bitCount = 0; | |
while(x){ | |
if(x & 1){ | |
bitCount++; |
NewerOlder