Skip to content

Instantly share code, notes, and snippets.

View wontheone1's full-sized avatar

WON SEOB SEO wontheone1

View GitHub Profile
use actix_web::{App, web, HttpResponse, HttpServer, Result};
use std::sync::Mutex;
use serde::{Deserialize, Serialize};
use serde_json;
use std::ops::Deref;
fn dd() -> &'static str {
r#"{
"id": "8381a025-61fc-4479-b335-cc60b0b87b60",
"name": "Generic cotton t-shirt",
@wontheone1
wontheone1 / main.rs
Created May 17, 2020 21:41
Failing actix test
use actix_web::{App, web, get, HttpResponse, HttpServer};
use std::sync::Mutex;
struct AppStateWithCounter {
counter: Mutex<i32>, // <- Mutex is necessary to mutate safely across threads
}
#[get("/")]
async fn index(data: web::Data<AppStateWithCounter>) -> HttpResponse {
let mut counter = data.counter.lock().unwrap(); // <- get counter's MutexGuard
use actix_web::{web, App, HttpResponse, HttpServer, Responder};
async fn index() -> impl Responder {
HttpResponse::Ok().body("Hello world!")
}
async fn index2() -> impl Responder {
HttpResponse::Ok().body("Hello world again!")
}
$ python3 run_locally.py
err = 3 /opt/blizzard/buildserver/data.noindex/repositories/sc2/branches/SC2.4.9/Game/Contrib/macteam/libs/ClampCursor/Contrib/mach_override/mach_override.c:244
err = 3 /opt/blizzard/buildserver/data.noindex/repositories/sc2/branches/SC2.4.9/Game/Contrib/macteam/libs/ClampCursor/Contrib/mach_override/mach_override.c:258
err = 3 /opt/blizzard/buildserver/data.noindex/repositories/sc2/branches/SC2.4.9/Game/Contrib/macteam/libs/ClampCursor/Contrib/mach_override/mach_override.c:263
INFO:sc2.protocol:Client status changed to Status.launched (was None)
INFO:sc2.controller:Creating new game
INFO:sc2.controller:Map: AbyssalReefLE
INFO:sc2.controller:Players: Bot(Race.Random, <bot.main.MyBot object at 0x10c106438>), Computer(Race.Random, Difficulty.Medium)
INFO:sc2.protocol:Client status changed to Status.init_game (was Status.launched)
INFO:sc2.protocol:Client status changed to Status.in_game (was None)
@wontheone1
wontheone1 / a.py
Last active February 26, 2019 20:38
Error
1 0 0 0 0
IMPOSSIBLE
1 1 0 0
1 1 0 1
0 0 0 0
---------------------------------------------------------------------------
_RemoteTraceback Traceback (most recent call last)
_RemoteTraceback:
"""
Traceback (most recent call last):
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
If your shell is Bash or a Bourne variant, enable conda for the current user with
$ echo ". /home/pghoou/anaconda3/etc/profile.d/conda.sh" >> ~/.bashrc
or, for all users, enable conda with
$ sudo ln -s /home/pghoou/anaconda3/etc/profile.d/conda.sh /etc/profile.d/conda.sh
The options above will permanently enable the 'conda' command, but they do NOT
# Before running the script your kaggle.json file in ~/.kaggle folder
# This script downloads all data from
# https://www.kaggle.com/c/dogs-vs-cats-redux-kernels-edition
# And puts them into subdirectories so that it is easily usable with fast ai
# and easily make predictions for the test data and submit.
@wontheone1
wontheone1 / setup.sh
Last active October 6, 2018 15:35
Fastai setup script for GCP compute engine
#! /bin/bash
DEBIAN_FRONTEND=noninteractive
sudo apt update
mkdir downloads
cd downloads
# INSTALL ANACONDA 5.3.0
@wontheone1
wontheone1 / HackerrankNewYearChaos.c
Last active September 7, 2018 20:19
Hackerrank New Year Chaos
1 2 3 4 5 6 7 8 ; Indices
1 2 3 4 5 6 7 8 ; person-numbers
0 0 0 0 0 0 0 0 ; person-numbers - indices
0 0 0 0 0 0 0 0 ; accumulated difference
; sum of accumulated difference: 0
; Total bribery: 0
1 2 3 4 5 6 7 8 ; Indices
1 2 3 5 4 6 7 8 ; person-numbers
0 0 0 1 -1 0 0 0 ; person-numbers - indices
(defn rot [string]
(for [index (range (count string))]
(->> (reverse (split-at index string))
(apply concat)
(apply str))))
(defn contain-all-rots [strng vec-str]
(every? (set vec-str) (rot strng)))