env GOOS=target-OS GOARCH=target-architecture go build package-import-path
# Example
env GOOS=darwin GOARCH=amd64 go build
env GOOS=darwin GOARCH=amd64 go build main.go
env GOOS=darwin GOARCH=amd64 go build github.com/zoo/york/foo/bar
<?php | |
// a simple key/val store using php & sqlite3 | |
// license: http://gist.github.com/375593 | |
// edited by alekssamos | |
/* Added multithreading: https://habr.com/ru/articles/204438/ */ | |
class SqliteStore { | |
protected $db; | |
public function __construct($tableName, $filePath = 'db.sqlite') { |
""" | |
This gist shows how to run asyncio loop in a separate thread. | |
It could be useful if you want to mix sync and async code together. | |
Python 3.7+ | |
""" | |
import asyncio | |
from datetime import datetime | |
from threading import Thread | |
from typing import Tuple, List, Iterable |
import cProfile | |
def profileit(func): | |
""" | |
Decorator (function wrapper) that profiles a single function | |
@profileit() | |
def func1(...) | |
# do something | |
pass |
from glob import glob | |
import multiprocessing | |
from concurrent.futures import ProcessPoolExecutor | |
import cv2 | |
from PIL import Image | |
import imagehash | |
from tqdm import tqdm |
#!/bin/bash | |
## http://helpexe.ru/programmirovanie/kak-vkljuchit-zvuk-v-kali-linux | |
# Check the script is being run by root | |
if [ "$(id -u)" != "0" ]; then | |
echo "This script must be run as root" | |
exit 1 | |
fi |
[package] | |
name = "test" | |
version = "0.1.0" | |
authors = ["YOU <YOU@users.noreply.github.com>"] | |
edition = "2018" | |
[lib] | |
crate-type = ["cdylib"] |
/* https://ru.stackoverflow.com/q/557656 */ | |
/* Теперь понятно, как работает callback-data */ | |
<?php | |
$access_token = 'xxx'; | |
$api = 'https://api.telegram.org/bot' . $access_token; | |
$output = json_decode(file_get_contents('php://input'), TRUE); | |
$chat_id = $output['message']['chat']['id']; | |
$message = $output['message']['text']; | |
$callback_query = $output['callback_query']; | |
$data = $callback_query['data']; |
from threading import Lock | |
import os, os.path | |
try: | |
import dill as pickle | |
import dill.settings | |
from dill import FILE_FMODE | |
dill.settings.update({'byref': True, 'fmode': FILE_FMODE, 'recurse': True, 'ignore': True}) | |
except ImportError: | |
import pickle |
#!/bin/bash | |
# https://www.shellhacks.com/ru/bash-test-if-file-exists/ | |
# https://habr.com/ru/company/ruvds/blog/325928/ | |
# http://qaru.site/questions/41427/how-to-check-if-a-file-contains-a-specific-string-using-bash | |
# http://blog.richim.org/2011/10/bash.html | |
# Check the script is being run by root | |
if [ "$(id -u)" != "0" ]; then | |
echo "This script must be run as root" |