Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Mindaugas Milius grambas

🏠
Working from home
Block or report user

Report or block grambas

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View TextToImage
class TextToImage
{
/**
* @param string $text
* @param int $width
* @param int $height
* @param int $font
*
* @return Response
*/
View 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
View read_serial.py
#!/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
View maintaince.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 / alias.md
Last active Jan 21, 2019
[Docker] Docker related snippets and scripts
View alias.md

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:
View git.md

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"
View 1.md

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 / trav-get-names.js
Last active Jan 21, 2019 — forked from Yiin/userscript.js
[Userscripts]
View trav-get-names.js
// ==UserScript==
// @name Unnamed Script 760860
// @version 1
// @grant GM.xmlHttpRequest
// get all players who sent reinforcement
// ==/UserScript==
(async () => {
const rows = [...document.querySelectorAll('#overview > tbody > tr')];
const thisPlayer = document.getElementsByClassName('playerName')[0].childNodes[3].innerHTML;
View send_to_channel.php
<?php
/**
Send message to slack channel.
$hook can be created at https://mindau.slack.com/apps/A0F7XDUAZ-incoming-webhook
*/
function sendLog($title, $msg)
{
$hook = "https://hooks.slack.com/services/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$data = array(
'channel' => '#logging',
View commands.md
Check what process is using a port
netstat -tulpn | grep 80
Search in 'path' for 'pattern' in files
grep -rnw 'path' -e 'pattern'
Search in 'to/path' for file 'pattern'
You can’t perform that action at this time.