Справочник переехал: https://github.com/hflabs/city
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 get_top_n_words(corpus, n=None): | |
""" | |
List the top n words in a vocabulary according to occurrence in a text corpus. | |
get_top_n_words(["I love Python", "Python is a language programming", "Hello world", "I love the world"]) -> | |
[('python', 2), | |
('world', 2), | |
('love', 2), | |
('hello', 1), | |
('is', 1), |
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
# use ImageMagick convert | |
# the order is important. the density argument applies to input.pdf and resize and rotate to output.pdf | |
convert -density 90 input.pdf -rotate 0.5 -attenuate 0.2 +noise Multiplicative -colorspace Gray output.pdf |
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
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work. | |
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0." | |
Database files have to be updated before starting the server, here are the steps that had to be followed: | |
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default | |
brew unlink postgresql | |
brew install [email protected] | |
brew unlink [email protected] | |
brew link postgresql |
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
#!/usr/bin/env bash | |
# install docker | |
# https://docs.docker.com/engine/installation/linux/ubuntulinux/ | |
# install docker-compose | |
# https://docs.docker.com/compose/install/ | |
# install letsencrypt | |
# https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04 |
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
<?php | |
ini_set('display_errors', 1); | |
ini_set('display_startup_errors', 1); | |
error_reporting(E_ALL); | |
$database = 'db'; | |
$user = 'user'; | |
$pass = 'pass'; | |
$host = 'localhost'; |
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
# Backup DB | |
docker run \ | |
--rm \ | |
--link running_mongo:mongo \ | |
-v /data/mongo/backup:/backup \ | |
mongo \ | |
bash -c ‘mongodump --out /backup --host $MONGO_PORT_27017_TCP_ADDR’ | |
# Download the dump | |
scp -r USER@REMOTE:/data/mongo/backup ./backup | |
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 React, {PropTypes} from 'react'; | |
export const Tab = (props) => { | |
return ( | |
<li className="tab"> | |
<a className={`tab-link ${props.linkClassName} ${props.isActive ? 'active' : ''}`} | |
onClick={(event) => { | |
event.preventDefault(); | |
props.onClick(props.tabIndex); | |
}}> |
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
using Microsoft.OpenApi.Models; | |
using Swashbuckle.AspNetCore.Swagger; | |
using Swashbuckle.AspNetCore.SwaggerGen; | |
using System.Collections.Generic; | |
namespace BoundedContext.Web.Swagger | |
{ | |
/// <summary> | |
/// This class orginally was created by https://gist.github.com/smaglio81 and modified version used in this project you can find here | |
/// https://gist.github.com/rafalkasa/01d5e3b265e5aa075678e0adfd54e23f |
NewerOlder