Skip to content

Instantly share code, notes, and snippets.

View sevkin's full-sized avatar

Vsevolod Balashov sevkin

View GitHub Profile
@sevkin
sevkin / ymap.js
Last active February 11, 2024 22:20
sample yandex.maps AMD module
/*
requirejs.config({
paths: {
'ymaps': ['//api-maps.yandex.ru/2.0-stable/?load=package.standard&lang=ru-RU']
},
shim: {
'ymaps': {exports: 'ymaps'}
}
});
*/
@sevkin
sevkin / main.go
Created April 11, 2014 20:11
custom middleware for martini
func Vermut() *martini.ClassicMartini {
r := martini.NewRouter()
m := martini.New()
m.Use(martini.Logger())
m.Use(martini.Recovery())
// pass cached images to thumbnailer
m.Use(NewThumbnailer("public"))
cache := martini.NewRouter()
cache.Group("/cache", cacheHandler)
@sevkin
sevkin / install_skype.sh
Last active April 6, 2017 08:40
Install skype on ubuntu 14.04 amd64
https://web.skype.com <- all what you need
# dpkg --add-architecture i386
# add-apt-repository "deb http://archive.canonical.com/ $(lsb_release -sc) partner"
# add-apt-repository ppa:skype-wrapper/ppa
# apt-get update
# apt-get install skype skype-wrapper sni-qt:i386
# apt-mark auto sni-qt:i386
# apt-get install gtk2-engines-murrine:i386 gtk2-engines-pixbuf:i386
# TODO add app-arrmor
@sevkin
sevkin / gist:40d619c158a5a509ef42
Created November 7, 2014 14:01
rotate docker containers logs
/var/lib/docker/containers/*/*.log {
rotate 7
daily
compress
delaycompress
copytruncate
sharedscripts
postrotate
/usr/bin/docker restart forwarder
endscript
@sevkin
sevkin / dnsmasq.yml
Last active February 13, 2017 13:23
Install standalone dnsmasq instead of NetworkManager controlled - ansible playbook - ubuntu 16.04
---
- hosts: localhost
connection: local
# gather_facts: no
become: yes
vars:
- interfaces: ["lo", "docker0"]
tasks:
- name: install dnsmasq
@sevkin
sevkin / url_open.go
Last active September 11, 2024 14:08
golang open url in default browser
// https://stackoverflow.com/questions/39320371/how-start-web-server-to-open-page-in-browser-in-golang
// open opens the specified URL in the default browser of the user.
func open(url string) error {
var cmd string
var args []string
switch runtime.GOOS {
case "windows":
cmd = "cmd"
args = []string{"/c", "start"}
@sevkin
sevkin / mongo-docker.bash
Created July 27, 2017 13:01 — forked from davideicardi/mongo-docker.bash
Running mongodb inside a docker container (with mongodb authentication)
# Create a container from the mongo image,
# run is as a daemon (-d), expose the port 27017 (-p),
# set it to auto start (--restart)
# and with mongo authentication (--auth)
# Image used is https://hub.docker.com/_/mongo/
docker pull mongo
docker run --name YOURCONTAINERNAME --restart=always -d -p 27017:27017 mongo mongod --auth
# Using the mongo "localhost exception" (https://docs.mongodb.org/v3.0/core/security-users/#localhost-exception)
# add a root user
@sevkin
sevkin / loader.html
Created August 21, 2017 09:45 — forked from bellbind/loader.html
[threejs][html5]STL File Viewer with HTML5 File API
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>STL File Viewer</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r68/three.min.js"
></script>
<script src="https://rawgit.com/mrdoob/three.js/master/examples/js/controls/TrackballControls.js"
></script>
<script src="loader.js"></script>
@sevkin
sevkin / firewall_custom_rules.sh
Last active December 8, 2018 20:22
openwrt router + usb_ether modem
# luci > net > firewall > custom_rules
#
# add modem (eth1) to lan bridge
#
# drop modem dhcp (modem is static 192.168.1.2)
iptables -A input_lan_rule -p udp --src 192.168.1.2 --destination-port 68 -j DROP
iptables -A forwarding_lan_rule -p udp --src 192.168.1.2 --destination-port 68 -j DROP
@sevkin
sevkin / ulimit.conf
Last active March 11, 2019 09:08
nginx php-fpm bitrix pcre.recursion_limit
[Service]
LimitSTACK=infinity
# mkdir /etc/systemd/system/php-fpm.service.d
# cd /etc/systemd/system/php-fpm.service.d
# vi ulimit.conf
# systemctl daemon-reload
# systemctl restart php-fpm