Skip to content

Instantly share code, notes, and snippets.

Установка приватного пакета с помощью composer

  1. Необходимо создать ssh ключ и добавить его в настройки профиля GitHub, которому пренадлежит нужный репозиторий, если это не было сделано ранее.

Tip: вы можете использовать данный скрипт для создания и добавления SSH ключа.

  1. Указать url приватного репозитория в composer.json следующим образом:
"repositories": [
@pcuenca
pcuenca / openelm-coreml.py
Created April 30, 2024 09:55
Convert OpenELM to Core ML (float32)
import argparse
import numpy as np
import torch
import torch.nn as nn
import coremltools as ct
from transformers import AutoTokenizer, AutoModelForCausalLM
# When using float16, all predicted logits are 0. To be debugged.
compute_precision = ct.precision.FLOAT32
compute_units = ct.ComputeUnit.CPU_ONLY
@alexreardon
alexreardon / how-this-works.md
Created August 7, 2022 00:29
How `this` works in javascript

this binding

  • this is the runtime context of a function.
  • this is determined by the call site
  • the same function can be executed with different this runtime contexts. You can think of this as another arguement to the function
  • Comparison: scopes are generally defined at compile time (exception: eval)
const person = {
 name: 'Alex',
@nikolovlazar
nikolovlazar / keybindings.json
Created April 29, 2024 01:12
VSCode key bindings to navigate like Neovim
[
// Navigation
{
"key": "ctrl-h",
"command": "workbench.action.navigateLeft"
},
{
"key": "ctrl-l",
"command": "workbench.action.navigateRight"
},
\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows, calc, chains, positioning}
\begin{document}
\begin{tikzpicture}[node distance = 4mm and 0mm,
box/.style = {shape=rectangle, draw, minimum size=2em, outer sep=0pt, on chain=#1},
sum/.style = {shape=circle, draw, inner sep=0pt, node contents={$+$}},
every path/.append style = {-latex'}
@jimkring
jimkring / image.py
Last active May 2, 2024 00:16
fastui raw html component example
import io
import base64
from typing import Union
from PIL import Image # requires `pillow` package
from fastui.components import Iframe
def iframe_from_html_raw(
raw_html: str,
@naviocean
naviocean / git_large_file.md
Created September 14, 2020 07:36
Fixing the “GH001: Large files detected. You may want to try Git Large File Storage.”

Fixing the “GH001: Large files detected. You may want to try Git Large File Storage.”

I just migrated my repositories from BitBucket to GitHub but, suddenly, I received an interesting error when I tried to push a repo with some large files inside.

remote: error: GH001: Large files detected. You may want to try Git Large File Storage — https://git-lfs.github.com.
remote: error: Trace: b5116d865251981c96d4b32cdf7ef464
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File fixtures/11_user_answer.json is 131.37 MB; this exceeds GitHub’s file size limit of 100.00 MB
@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active May 2, 2024 00:14
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized

Docker Hub 镜像加速器

国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。Docker 官方和国内很多云服务商都提供了国内加速器服务。

Dockerized 实践 https://github.com/y0ngb1n/dockerized

配置加速地址

Ubuntu 16.04+、Debian 8+、CentOS 7+

@davispuh
davispuh / steam_console_params.txt
Last active May 2, 2024 00:13
Steam client parameters, consoles commands and variables
-480p - Run tenfoot in 480p rather than 1080p
-720p - Run tenfoot in 720p rather than 1080p
-accesscode -
-all_languages - show longest loc string from any language
-batterytestmode - rapidly cycle battery percentages for testing
-bigpicture - Start in Steam Big Picture mode
-blefw -
-cafeapplaunch - Launch apps in a cyber cafe context
-candidates - Show libjingle candidates for local connection as they are processed
-ccsyntax - Spew details about the localized strings we load
@liviaerxin
liviaerxin / README.md
Last active May 2, 2024 00:04
FastAPI and Uvicorn Logging #python #fastapi #uvicorn #logging

FastAPI and Uvicorn Logging

When running FastAPI app, all the logs in console are from Uvicorn and they do not have timestamp and other useful information. As Uvicorn applies python logging module, we can override Uvicorn logging formatter by applying a new logging configuration.

Meanwhile, it's able to unify the your endpoints logging with the Uvicorn logging by configuring all of them in the config file log_conf.yaml.

Before overriding:

uvicorn main:app --reload