Skip to content

Instantly share code, notes, and snippets.

View grambas's full-sized avatar

Mindaugas Milius grambas

View GitHub Profile
@grambas
grambas / 1.md
Last active January 15, 2019 12:43
REGEX

Validate string for PHP DateInterval. (P or PT, then any number with no leading zeros. At the end H for hour interval and W,D or M for weeks, days and months)

(P((0|[1-9][0-9]*))(W|D|M)|PT((0|[1-9][0-9]*))H)
@grambas
grambas / git.md
Last active January 21, 2019 19:05
[GIT]

lazy one command commit

alias lazygit="git add .; git commit -a -m 'lazy commit'; git push;";

git lg command to style log output

git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
@grambas
grambas / alias.md
Last active January 21, 2019 18:57
[Docker] Docker related snippets and scripts

CLEAN DOCKER COMPLETLY

echo "alias docker-clean-unused='docker system prune --all --force --volumes'
alias docker-clean-containers='docker container stop $(docker container ls -a -q) && docker container rm $(docker container ls -a -q)'
alias docker-clean-all='docker container stop $(docker container ls -a -q) && docker system prune -a -f --volumes'" \
>> ~/.zshrc && source ~/.zshrc     ##  for zsh:

>> ~/.bashrc && source ~/.bashrc   ##  for bash:
@grambas
grambas / maintaince.html
Last active January 21, 2019 19:00
[HTML]
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@grambas
grambas / read_serial.py
Created February 15, 2019 10:51
Embedded #python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" This Module reads data from serial port
then converts to JSON and sends to Amazon Firebase
"""
import serial
from time import sleep
from firebase import firebase
@grambas
grambas / install_netextender_ubuntu_64_bit
Created June 3, 2019 17:58 — forked from egobude/install_netextender_ubuntu_64_bit
Install NetExtender | Ubuntu 64 Bit
1. go to https://sslvpn.demo.sonicwall.com/cgi-bin/welcome
2. log in with demo/password
3. click on NetExtender icon, this will download a tar.gz with the client
4. sudo ln -s /lib/x86_64-linux-gnu/libssl.so.1.0.0 /usr/lib/libssl.so.6
5. sudo ln -s /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 /usr/lib/libcrypto.so.6
6. un-tar the client, make install script executable and launch install
class TextToImage
{
/**
* @param string $text
* @param int $width
* @param int $height
* @param int $font
*
* @return Response
*/
@grambas
grambas / clean_mysql_bin_logs.sh
Last active November 2, 2020 19:00
cleant mysq bin logs
docker exec -it -u root DB_CONTAINER_NAME /bin/bash
mysql -u root -p
PURGE BINARY LOGS BEFORE NOW(); # OR RESET MASTER;
# check option
SELECT * FROM performance_schema.global_variables WHERE VARIABLE_NAME IN ('log_bin');
@grambas
grambas / git-pull-all
Created February 16, 2022 07:50 — forked from grimzy/git-pull-all
Git pull all remote branches
#!/usr/bin/env bash
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all
@grambas
grambas / git.migrate
Last active February 16, 2022 07:51 — forked from niksumeiko/git.migrate
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.