Skip to content

Instantly share code, notes, and snippets.

@natansdj
natansdj / git-checkout-all.plugin.zsh
Created September 12, 2025 07:35
zsh plugin git checkout all plugin, Checkout the same branch across all repositories in current directory
# Git Checkout All Plugin
# Author:
# Description: Checkout the same branch across all repositories in current directory
#
# Features of this plugin:
#
# Enhanced error handling - Checks if directories and branches exist
# Remote branch support - Automatically creates local branches from remote if they exist
# Progress indicators - Shows success/failure with emojis and counts
# Multiple useful functions:
@natansdj
natansdj / findUniqueNumbers.php
Last active July 15, 2024 16:09
PHP Test Dome sample
<?php
function findUniqueNumbers(array $numbers) : array
{
foreach ($numbers as $k => $val){
if(!isset($numbers[$k])) continue;
$found = false;
for ($j = $k + 1; $j < count($numbers); ++$j) {
if (isset($numbers[$k]) && isset($numbers[$j]) && $numbers[$k] === $numbers[$j]) {
$found = true;
@natansdj
natansdj / Dockerfile
Created March 24, 2021 15:00 — forked from paulrobello/Dockerfile
Custom apache php dev with added mssql pdo driver Dockerfile
FROM webdevops/php-apache-dev:7.4
# add microsoft packages to apt sources
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql-release.list
# install needed system packages as well as a few nice to have utils
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get -y upgrade && \
ACCEPT_EULA=Y apt-get -y install msodbcsql17 unixodbc-dev less joe iputils-ping traceroute telnet && \
apt-get purge -y --auto-remove && \
@natansdj
natansdj / change_definer.php
Created December 26, 2019 19:23
Change DEFINER of MySQL objects from old_name to new_name - PHP 7 supported
<?php
require "mysql_mysqli.inc.php";
// ===== configration part starts =====
$for_real = true; // execute DDL statements
$verbose = true; // show DDL statements
$db_host = "localhost";
$db_user = "root";
@natansdj
natansdj / docker_network_create_dev.sh
Created February 18, 2019 09:03
docker create dev network
#!/bin/sh
docker network create -d bridge --subnet 172.18.0.0/16 \
--gateway=172.18.0.1 \
--opt com.docker.network.bridge.enable_icc=true \
--opt com.docker.network.bridge.enable_ip_masquerade=true \
--opt com.docker.network.bridge.host_binding_ipv4=0.0.0.0 \
--opt com.docker.network.driver.mtu=1500 \
--opt com.docker.network.bridge.name="docker1" \
dev
@natansdj
natansdj / migration_drop_foreign.php
Last active February 14, 2019 06:49
Laravel migration check if index is exists
<?php
$sm = Schema::getConnection()->getDoctrineSchemaManager();
$idxVouchers = $sm->listTableIndexes('vouchers');
if(array_key_exists('vouchers_voucher_type_id_index', $idxVouchers)) {
//index exists
} else {
//index not exists
}
@natansdj
natansdj / init-docker-credentials-pass.md
Created December 28, 2018 06:59
initalize docker to use docker-credentials-pass

here is what i did to get my docker client working with docker-credentials-pass.

  1. Install pass
sudo apt-get install pass
  1. Download, extract, make executable, and move docker-credential-pass
@natansdj
natansdj / docker-help.md
Created December 12, 2018 16:41 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@natansdj
natansdj / satoshi.txt
Last active December 12, 2018 16:40
Newsweek Satoshi Story
Satoshi Nakamoto stands at the end of his sunbaked driveway looking timorous. And annoyed.
He's wearing a rumpled T-shirt, old blue jeans and white gym socks, without shoes, like he has left the house in a hurry. His hair is unkempt, and he has the thousand-mile stare of someone who has gone weeks without sleep.
He stands not with defiance, but with the slackness of a person who has waged battle for a long time and now faces a grave loss.
Two police officers from the Temple City, Calif., sheriff's department flank him, looking puzzled. "So, what is it you want to ask this man about?" one of them asks me. "He thinks if he talks to you he's going to get into trouble."
"I don't think he's in any trouble," I say. "I would like to ask him about Bitcoin. This man is Satoshi Nakamoto."
@natansdj
natansdj / README.md
Created December 12, 2018 16:14 — forked from nikcub/README.md
Install Python 2.7.11 on Ubuntu 14.04

Install latest Python 2.7.11 on Ubuntu 14.04

This script will install the latest version of the 2.7.x branch of Python alongside the system Python in the users local directory and it will symlink all the binaries in ~/bin

Any app or daemon that you require to run with the latest Python just run it as either the separate user or make sure it is running from the Python linked into `/bin

Arguments

install-python.sh <version> <path>