Skip to content

Instantly share code, notes, and snippets.

@marvell
marvell / hidden_spotlight_icon.md
Created January 30, 2014 08:47
Hidden Spotlight icon #tips #osx

При работе с Alfred было бы логично вовсе убрать иконку Spotlight из верхнего меню. Для этого запустите терминал и введите команду:

$ sudo chmod 600 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search

Вернуть иконку можно командой:

$ sudo chmod 755 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search

Не забывайте каждый раз пререзагружать меню командой:

# Show hidden files in Finder
# OSX 10.9 Mavericks
defaults write com.apple.finder AppleShowAllFiles TRUE && killall Finder
OSX 10.7 - !0.8
defaults write com.apple.finder AppleShowAllFiles TRUE && killall Finder
# Hide hidden files in Finder
@marvell
marvell / rvm_paths.sh
Created June 13, 2014 18:18
Load RVM paths into .bashrc file
# Load RVM into a shell session as a function
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
# First try to load from a user install
source "$HOME/.rvm/scripts/rvm"
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
# Then try to load from a root install
source "/usr/local/rvm/scripts/rvm"
else
printf "ERROR: An RVM installation was not found.\n"
fi
@marvell
marvell / tunneling_over_ssh
Created April 30, 2015 15:45
Проброс портов с удаленной машинки на локальную через SSH
$ ssh -f -N -L 9906:127.0.0.1:3306 user@database.example.com
#!/usr/bin/env bash
set -x
pid=0
# SIGUSR1-handler
my_handler() {
echo "my_handler"
}
docker run --name=redis -d redis
docker run --name=postgres -e POSTGRES_PASSWORD=secret -d postgres
docker exec postgres createdb -U postgres -E utf-8 sentry
docker run --rm -it --link=postgres:postgres --link=redis:redis -v $(pwd):/home/user/.sentry sentry sentry upgrade
docker run --name=sentry --env="VIRTUAL_HOST=sentry.ndr.su" --link=postgres:postgres --link=redis:redis -v $(pwd):/home/user/.sentry -d sentry
docker run --name=sentry-celery --link=postgres:postgres --link=redis:redis -v $(pwd):/home/user/.sentry -d sentry sentry celery worker -B
@marvell
marvell / gist:01d053ebd2090c8b056a
Created June 28, 2015 13:00
enable ability to select text in QuickLook
defaults write com.apple.finder QLEnableTextSelection -bool true
killall Finder
@marvell
marvell / tile_hash.go
Created August 4, 2015 09:33
Get tile hash by ZXY
func getTileHash(z, x, y int) int64 {
positions := make(map[int][2]int)
for currentZoom := 1; currentZoom <= z; currentZoom++ {
tileSize := int(math.Pow(2, float64(z-currentZoom)))
centerX, centerY := tileSize-1, tileSize-1
if currentZoom > 1 {
n := int(math.Pow(2, float64(currentZoom-1)))
centerX += positions[currentZoom-1][0] * n
@marvell
marvell / Dockerfile
Created November 30, 2015 09:32
Dockerfile tips
# Отключаем любые promt
ENV DEBIAN_FRONTEND noninteractive
# Удаляем мусор из имиджа
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Использование glibc для alpine
FROM alpine:3.2
RUN apk --update add curl ca-certificates && \
curl -Ls https://circle-artifacts.com/gh/andyshinn/alpine-pkg-glibc/6/artifacts/0/home/ubuntu/alpine-pkg-glibc/packages/x86_64/glibc-2.21-r2.apk > /tmp/glibc-2.21-r2.apk && \