Skip to content

Instantly share code, notes, and snippets.

View yakubenko's full-sized avatar
👽
Eat. Sleep. Code.

Stanislav Yakubenko yakubenko

👽
Eat. Sleep. Code.
View GitHub Profile
@kaspergrubbe
kaspergrubbe / geonames_postgres.rb
Last active April 15, 2025 21:39
Import files from Geonames.com into a PostgreSQL database that runs Postgis
#!/usr/bin/env ruby
require 'open3'
require 'fileutils'
def run_command(command)
puts("+: " + command)
Open3.popen2e(command) do |stdin, stdout_stderr, wait_thread|
Thread.new do
stdout_stderr.each {|l| puts l }
@andrewstobbe
andrewstobbe / MacOSXSierra:Brew+Apache+Mysql+PHPSwitcher+DNSMasq+SSL.md
Last active July 19, 2021 02:12
Mac OSX Sierra : Brew Apache + Mysql + PHP Switcher + DNSMasq + SSL

Mac OSX Sierra : Brew Apache + Mysql + PHP Switcher + DNSMasq + SSL 👍

Things I had to do using Homebrew to get my local web dev environment back up and running after migration to OSX Sierra + Xcode 8.1.

Note: I used brew reinstall because I had already installed most of this previously under Yosemite. Probably better ways to do this, but this is what worked for me.

brew doctor

brew tap homebrew/dupes
brew tap homebrew/versions
@wayanjimmy
wayanjimmy / AuthServiceProvider.php
Last active January 4, 2024 09:32
Extend Laravel SessionGuard
<?php
namespace App\Providers;
use App\Extensions\SessionAnonymousGuard;
use Illuminate\Auth\SessionGuard;
use Illuminate\Contracts\Auth\Access\Gate as GateContract;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
@solancer
solancer / apache-nginx-ftp
Created July 27, 2016 10:53
Correct permissions for /var/www/html
// Adding current user to www-data
sudo adduser $USER www-data
//change ownership to user:www-data and
sudo chown $USER:www-data -R /var/www/html
sudo chmod u=rwX,g=srX,o=rX -R /var/www/html
// change file permissions of existing files and folders to 755/644
sudo find /var/www/html -type d -exec chmod g=rwxs "{}" \;
ErrorException: proc_open(): fork failed - Cannot allocate memory in phar:///usr/local/bin/composer/vendor/symfony/console/Application.php on line 954
It's because of a lack of memory. You need to set up a swap file so that composer can do it's thing:
sudo dd if=/dev/zero of=/swapfile bs=1024 count=512k
mkswap /swapfile
swapon /swapfile
@subfuzion
subfuzion / curl.md
Last active July 27, 2025 20:30
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@mrded
mrded / phantomjs
Last active December 24, 2020 12:10
Run phantomjs as a deamon
#! /bin/sh
# /etc/init.d/phantomjs
case "$1" in
start)
phantomjs --webdriver=4444 &
;;
stop)
pkill phantomjs
@Jaesin
Jaesin / drupal-8.conf
Last active April 20, 2021 16:13
Drupal 8 Nginx configuration
# @file
# NGINX Configuration file for Drupal 8
# Redirect index to php.
location / {
try_files $uri @rewrite;
}
# Allow but don't log access to /favicon.ico and /robots.txt
location ~ (^/favicon\.ico$|^/robots\.txt$) {
@l0ki000
l0ki000 / csd-wrapper.sh
Last active March 7, 2025 10:14 — forked from zer4tul/gist:6477470
Cisco Anyconnect CSD wrapper for OpenConnect (exhanced to autodownload and autoupdate hostscan)
#!/bin/bash
# Cisco Anyconnect CSD wrapper for OpenConnect
# Enter your vpn host here
CSD_HOSTNAME=
if [[ -z ${CSD_HOSTNAME} ]]
then
echo "Define CSD_HOSTNAME with vpn-host in script text. Exiting."
exit 1
fi
@codedokode
codedokode / Паттерны работы с базой данных.md
Last active September 23, 2024 10:27
Паттерны работы с базой данных

Это старая версия урока, которая больше не обновляется. Новая версия расположения тут: https://github.com/codedokode/pasta/blob/master/db/patterns-oop.md


Паттерны работы с базой данных

Разберемся, как правильно с применением ООП сохранять и загружать данные из базы. Существуют такие подходы: