Skip to content

Instantly share code, notes, and snippets.

View ksob's full-sized avatar

Kamil Sobieraj ksob

View GitHub Profile
@ksob
ksob / gist:a3d6342b0df28cc13d6ceed07e2d52f5
Last active October 25, 2019 17:55
Creating order via api
curl --request POST \
--url https://api.bigcommerce.com/stores/8pfocjmdoi/v3/carts \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'x-auth-client: fqun713qjaikqq4iedgzlcobgggfpo6' \
--header 'x-auth-token: 47e0daxu5b2lz6eh0kixsrjy4bgyuwp' \
--data '{"line_items":[{"quantity":1,"product_id":1140}]}'
@ksob
ksob / gist:5524d5b8e647e7be9531bcdf55700981
Created July 1, 2019 13:49
example JSON data output
{
{
obiekt: "pokój 4 osobowy z tarasem",
cena_total: "1200",
cena_details: {
adults: "700",
children: "200",
udogodnienia: {
oddzielny_taras: tak,
dodatkowe_posiłki: tak
@ksob
ksob / gist:4b28c14eef1b224437ac6167fde94cc3
Last active March 1, 2019 11:45
nginx on centos service
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /usr/local/nginx/conf/nginx.conf
# pidfile: /usr/local/nginx/logs/nginx.pid
import json
import os
import sys
from glob import iglob
from pathlib import Path
import numpy as np
import tensorflow as tf
from keras.applications.xception import preprocess_input
from keras.engine.saving import load_model
https://drive.google.com/file/d/1PIRu6ceRFzWgGH2WtrzrQCa7ouPGjypL/view?usp=sharing
# dla Python 3.6, czyli tego który jest
1. Zainstaluj co potrzebne:
sudo apt install python3-pip
pip3 install
pip3 install https://download.pytorch.org/whl/cpu/torch-1.0.1.post2-cp36-cp36m-linux_x86_64.whl
pip3 install torchvision
pip3 install fastai
@ksob
ksob / aa
Last active February 15, 2019 18:55
aaa
https://anaconda.org/pytorch/torchvision-cpu/0.2.1/download/noarch/torchvision-cpu-0.2.1-py_2.tar.bz2
pip3 install --no-index --find-links file:///home/osboxes/torchvision-cpu-0.2.1-py_2.tar.bz2
@ksob
ksob / gist:d19be1fa18f6628b0e6532bb520385c1
Created February 5, 2019 18:32
Jak uruchomić image classifier
1. Musisz zainstalować fast.ai, czyli bibliotekę python'a, najlepiej za pomocą anacond'y (wersja 4.6.2 lub wyższa).
(https://www.anaconda.com/distribution/#download-section)
Dalsze kroki dotyczą tylko instalacji za pomocą anacond'y.
2. Stwórz środowisko anacond'y na którym będzie instalowane fast.ai poleceniem:
$ conda create -n moje_srodowisko python=3
(moje_srodowisko to dowolna nazwa twojego środowiska)
3. Aktywuj środowisko :
@ksob
ksob / gist:28137572c997dea549ef728d4e89dc45
Created January 5, 2019 22:17
Mastodon input buffer
The task of sending messages / "toots" is delegated to background processing,
so whenever a new message "toot" is received by the server, it is added to a queue.
There is another thread/process that asynchornously reads from that queue and dispatches all these messages / "toots" to target users.
There is yet another thread/process that takes that dispatched messages and using WebSocket updates timelines
inside of visitors' browsers in real time.
When you run those 5 threads what you have mentioned, the side was not responding (i.e. hanging) because your
browser could not keep up with interpreting and displaying all those WebSocket updates.
In real live a single end user operating a single browser don't have this problem because
he doesn't receve such big amount of messages / "toots".
I observed how server behaves when 7 threads of the java seeder are being run against it and there was
https://github.com/culturecode/culturecode