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
def solve(students, music): | |
s = students[:] # simply copy the list to not mutate | |
zeroed_music = music - 1 # shit music index to 0 | |
delete_at = zeroed_music % len(s) # decides where to delete mod the size of students | |
while len(s) > 1: | |
print('Considering students %s and index %s' % (s, delete_at)) | |
del s[delete_at] | |
delete_at = (delete_at + zeroed_music) % len(s) | |
return s[0] |
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
package com.example.demo.controllers; | |
import com.example.demo.rating.Limiter; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.web.bind.annotation.GetMapping; | |
import org.springframework.web.bind.annotation.RequestParam; | |
import org.springframework.web.bind.annotation.RestController; | |
import reactor.core.publisher.Mono; | |
@RestController("/sample") |
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
stocks = [(24, '2014-01-02'), | |
(23, '2014-01-03'), | |
(22, '2014-01-04'), | |
(26, '2014-01-05'), | |
(19, '2014-01-06'), | |
(20, '2014-01-08'), | |
(25, '2014-01-09'), | |
(24, '2014-01-10')] | |
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
class CreateUsers::V20180206211408 < LuckyMigrator::Migration::V1 | |
def migrate | |
create :users do | |
add name : String | |
add age : Int32? | |
end | |
# Run custom SQL with execute | |
# | |
# execute "CREATE UNIQUE INDEX things_title_index ON things (title);" |
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 * as rp from "request"; | |
import { factory } from "../utils/logger"; | |
import { RequestResponse } from "request"; | |
const logger = factory.getLogger("squadify"); | |
export type Query = { | |
query: string, | |
variables: any |
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
type Person { | |
name: String (λ (root, args, ctx, info) | |
(surname root)) | |
age: Integer | |
} | |
type Query { | |
# Return all Organizations of an User |
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
{ | |
"vcs_url" : "https://github.com/circleci/mongofinil", | |
"build_url" : "https://circleci.com/gh/circleci/mongofinil/22", | |
"build_num" : 22, | |
"branch" : "master", | |
"vcs_revision" : "1d231626ba1d2838e599c5c598d28e2306ad4e48", | |
"committer_name" : "Allen Rohner", | |
"committer_email" : "[email protected]", | |
"subject" : "Don't explode when the system clock shifts backwards", | |
"body" : "", |
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 string import ascii_lowercase as lowercase | |
from string import ascii_uppercase as uppercase | |
from string import digits, punctuation | |
from random import randint, sample, shuffle | |
sources = [lowercase, digits, uppercase, punctuation] | |
def make_password(length, complexity): | |
assert(length >= 4) | |
assert(complexity >= 1 and complexity <= 4) |
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
package com.example | |
import akka.http.scaladsl.model.StatusCodes | |
import akka.http.scaladsl.server.{HttpApp, Route} | |
import scala.collection.concurrent.TrieMap | |
object WebServerHttpApp extends HttpApp with App { |
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
const fs = require('fs'); | |
const csvWriter = require('csv-write-stream') | |
const writer = csvWriter({ headers: ["id", "name"]}); | |
const faker = require('faker'); | |
writer.pipe(fs.createWriteStream('out.csv')) | |
for (var i = 1; i < 2000000; i++) { |