Skip to content

Instantly share code, notes, and snippets.

Working from home

Mindaugas Milius grambas

Working from home
View GitHub Profile
grambas / The Technical Interview Cheat
Created Sep 21, 2016 — forked from tsiege/The Technical Interview Cheat
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.
View The Technical Interview Cheat

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
grambas /
Last active Feb 15, 2019
[ffmpeg] Recodring, streaming, ripping
#! python
# Record stream with python from m3u8 file in 1h parts
import time
import subprocess as sp, sys
import urllib
def record():
sourcePath ='https://url.m3u8'
name = '_video.ts'
View Unlimited_parameters_in_route.php
public function show($slugs_string){
$slugs = explode('/', $slugs_string);
$page = null;
foreach($slugs as $key => $slug){
$page = Page::where('slug', $slug)
->where('parent_id', '=', is_null($page)?null:$page->id)
grambas / domain.conf
Last active Jan 21, 2019
[Webserver Security]
View domain.conf
# Common bandwidth hoggers and hacking tools.
map $http_user_agent $limit_bots {
default 0;
~*(AltaVista|Slurp|BlackWidow|Bot|ChinaClaw|Custo|DISCo|Download|Demon|eCatch|EirGrabber|EmailSiphon|EmailWolf|SuperHTTP|Surfbot|WebWhacker) 1;
~*(Express|WebPictures|ExtractorPro|EyeNetIE|FlashGet|GetRight|GetWeb!|Go!Zilla|Go-Ahead-Got-It|GrabNet|Grafula|HMView|Go!Zilla|Go-Ahead-Got-It) 1;
~*(rafula|HMView|HTTrack|Stripper|Sucker|Indy|InterGET|Ninja|JetCar|Spider|larbin|LeechFTP|Downloader|tool|Navroad|NearSite|NetAnts|tAkeOut|WWWOFFLE) 1;
~*(GrabNet|NetSpider|Vampire|NetZIP|Octopus|Offline|PageGrabber|Foto|pavuk|pcBrowser|RealDownload|ReGet|SiteSnagger|SmartDownload|SuperBot|WebSpider) 1;
~*(Teleport|VoidEYE|Collector|WebAuto|WebCopier|WebFetch|WebGo|WebLeacher|WebReaper|WebSauger|eXtractor|Quester|WebStripper|WebZIP|Wget|Widow|Zeus) 1;
~*(Twengabot|htmlparser|libwww|Python|perl|urllib|scan|Curl|email|PycURL|Pyth|PyQ|WebCollector|WebCopy|webcraw) 1;
View DEBUG MSG.cpp
#ifdef DEBUG
#define DEBUG_MSG(str) do { std::cout << str << std::endl; } while( false )
#define DEBUG_MSG(str) do { } while ( false )
int main()
DEBUG_MSG("Hello" << ' ' << "World!" << 1 );
return 0;
grambas /
Last active Jan 21, 2019
# Execute it as root, due to archiving permision conflicts
#CRONTAB entry for every day at 04:00 AM
#0 4 * * * /usr/local/bin/ >/dev/null 2>&1
# This bash script exports all mysql databases and archives it with all webserver files.
# Created archive will be encrypted with gpg key.
# After sending to cloud storage all created files will be deleted
# This script uses: tar, gpg, mysql and aws3 s3
# ** IMPORTANT** :
# ** You need to have generated gpg key !!! Otherwise comment encryption part.
# ** Execute this script with proper rights. It means that if in webserver dir
# you have files with permisions only for root user, then use sudo.
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'
View send_to_channel.php
Send message to slack channel.
$hook can be created at
function sendLog($title, $msg)
$hook = "";
$data = array(
'channel' => '#logging',
grambas / trav-get-names.js
Last active Jan 21, 2019 — forked from Yiin/userscript.js
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;