Skip to content

Instantly share code, notes, and snippets.

View mikaelz's full-sized avatar

Michal Zuber mikaelz

View GitHub Profile
@mikaelz
mikaelz / vpnwidget.lua
Created March 6, 2023 11:53 — forked from thatarchguy/vpnwidget.lua
Awesomewm vpn widget
-- add this to your rc.lua, or include it as a dependency
-- Don't forget to add this to the layout section:
-- right_layout:add(protonvpnwidget)
protonvpnwidget = wibox.widget.textbox()
protonvpnwidget:set_text(" ProtonVPN: N/A ")
protonvpnwidgettimer = timer({ timeout = 5 })
protonvpnwidgettimer:connect_signal("timeout",
function()
version: "3.2"
services:
wordpress:
image: wordpress
volumes:
- type: volume
source: www-data
target: /var/www/html
expose:
- 80
@mikaelz
mikaelz / get_time_from_ntp.php
Created September 17, 2018 10:54 — forked from bohwaz/get_time_from_ntp.php
Fetches timestamp from a NTP server in PHP
<?php
/**
* Returns UNIX timestamp from a NTP server (RFC 5905)
*
* @param string $host Server host (default is pool.ntp.org)
* @param integer $timeout Timeout in seconds (default is 10 seconds)
* @return integer Number of seconds since January 1st 1970
*/
function getTimeFromNTP($host = 'pool.ntp.org', $timeout = 10)
@mikaelz
mikaelz / docker-etc-hosts
Created July 26, 2018 10:00 — forked from Zaffy/docker-etc-hosts
Docker: print ips and containers' names suitable for use in /etc/hosts
for i in `docker ps -a -q | awk '{print $1}'`; do echo $(docker inspect --format="{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" $i) $(docker ps | grep $i | awk '{print $NF}') ; done
@mikaelz
mikaelz / gist:e6fee1798b9118bf9bd69626501bb1b1
Created August 28, 2017 06:28
Debug WordPress 404 issues (permalinks, rewrite rules, etc.)
/* Produces a dump on the state of WordPress when a not found error occurs */
/* useful when debugging permalink issues, rewrite rule trouble, place inside functions.php */
ini_set( 'error_reporting', -1 );
ini_set( 'display_errors', 'On' );
echo '<pre>';
add_action( 'parse_request', 'debug_404_rewrite_dump' );
function debug_404_rewrite_dump( &$wp ) {
@mikaelz
mikaelz / git-fork-update.md
Last active July 29, 2017 11:07 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd YOUR-FORKED-REPO
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@mikaelz
mikaelz / .htaccess
Created June 4, 2017 13:05 — forked from pranid/.htaccess
Prestashop .htaccess file for localhost :: please replace text 'yourproject' with your folder name
# ~~start~~ Do not remove this comment, prestashop will keep automatically the code outside this comment when .htaccess will be generated again
# .htaccess automaticaly generated by prestashop e-commerce open-source solution
# http://www.prestashop.com - http://www.prestashop.com/forums
<IfModule mod_rewrite.c>
<IfModule mod_env.c>
SetEnv HTTP_MOD_REWRITE On
</IfModule>
RewriteEngine on
# Basic commands
:Git [args] # does what you'd expect
all of your `~/.gitconfig` aliases are available.
:Git! [args] # same as before, dumping output to a tmp file
Moving inside a repo.
@mikaelz
mikaelz / post-receive
Created June 19, 2016 05:27 — forked from lemiorhan/post-receive
Post-receive hook to deploy the code being pushed to production branch to a specific folder
#!/bin/bash
target_branch="production"
working_tree="PATH_TO_DEPLOY"
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ -n "$branch" ] && [ "$target_branch" == "$branch" ]; then