Skip to content

Instantly share code, notes, and snippets.

View 2bj's full-sized avatar
🏠
Working from home

Bakyt 2bj

🏠
Working from home
View GitHub Profile
@2bj
2bj / wget.txt
Created July 2, 2020 10:36 — forked from iAugur/wget.txt
wget spider cache warmer
wget --spider -o wget.log -e robots=off -r -l 5 -p -S -T3 --header="X-Bypass-Cache: 1" -H --domains=live-mysite.mydomain.com --show-progress live-mysite.mydomain.com
# Options explained
# --spider: Crawl the site
# -o wget.log: Keep the log
# -e robots=off: Ignore robots.txt
# -r: specify recursive download
# -l 5: Depth to search. I.e 1 means 'crawl the homepages'.  2 means 'crawl the homepage and all pages it links to'...
# -p: get all images, etc. needed to display HTML page
# -S: print server response (to the log)
@2bj
2bj / homebrew-permissions.sh
Created February 17, 2019 22:03 — forked from jrenggli/homebrew-permissions.sh
Fix homebrew permissions
sudo chown -R $(whoami) /usr/local/Cellar
sudo chown -R $(whoami) /usr/local/Homebrew
sudo chown -R $(whoami) /usr/local/var/homebrew
sudo chown -R $(whoami) ${HOME}/Library/Caches/Homebrew
sudo chown -R $(whoami) ${HOME}/Library/Logs/Homebrew
sudo chown -R $(whoami) /usr/local/etc
sudo chown -R $(whoami) /usr/local/opt
sudo chown -R $(whoami) /usr/local/bin
sudo chown -R $(whoami) /usr/local/var
sudo chown -R $(whoami) /usr/local/share/man/man1
@2bj
2bj / how-to-set-up-stress-free-ssl-on-os-x.md
Created January 28, 2019 14:24 — forked from jed/how-to-set-up-stress-free-ssl-on-os-x.md
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@2bj
2bj / metro.sql
Created October 10, 2017 13:18 — forked from anonymous/metro.sql
Таблица станций московского метро
-- phpMyAdmin SQL Dump
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
@2bj
2bj / YandexMap.vue
Created March 22, 2017 21:37 — forked from reg2005/YandexMap.vue
YandexMap wrapper for VueJS 2
<template>
<div class="col-xs-12" style="padding:0;">
<div class="panel panel-default" style="margin:0;">
<div class="panel-body" style="padding:0;">
<div v-if="maps.length" :style="{height: height + 'px'}" id="map"></div>
<h3 v-else class="text-center">Нет точек</h3>
</div>
</div>
</div>
</template>

Multiple MySQL Versions with Homebrew

For homebrew version 0.9.5.

brew -v # => Homebrew 0.9.5

Install the current version of mysql.

# Install current mysql version

brew install mysql

@2bj
2bj / db-open
Created March 26, 2016 00:06 — forked from helderco/db-open
Script to open a mysql database in Sequel Pro from a service in docker-compose.
#!/bin/bash
set -e
show_help() {
cat << EOF
Usage: ${0##*/} [-u USER] [-p PASS] [-P PORT] [-H HOST] [DATABASE]
${0##*/} -h
Open a standard connection in Sequel PRO.
@2bj
2bj / redis-delallbykey
Created November 3, 2015 08:51 — forked from mattweyant/redis-delallbykey
Delete all keys from Redis matching a regular expression
# All credit: http://stackoverflow.com/questions/4006324/how-to-atomically-delete-keys-matching-a-pattern-with-redis
redis-cli [options] KEYS "prefix:*" | xargs redis-cli [options] DEL
php artisan --help OR -h
php artisan --quiet OR -q
php artisan --version OR -V
php artisan --no-interaction OR -n
php artisan --ansi
php artisan --no-ansi
php artisan --env
// -v|vv|vvv Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
php artisan --verbose
@2bj
2bj / redis-delkeys.sh
Last active August 29, 2015 14:19 — forked from jdp/redis-delkeys.sh
#!/bin/sh
#
# Usage: ./redis-delkeys.sh [-h host] [-p port] [-n db] pattern
#
# Matches keys with the KEYS command matching pattern
# and deletes them from the specified Redis DB.
set -e
HOST="localhost"