Skip to content

Instantly share code, notes, and snippets.

🍍
business as usual

Tadas Sasnauskas tadas-s

🍍
business as usual
Block or report user

Report or block tadas-s

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
@tadas-s
tadas-s / Vagrantfile
Created Oct 27, 2017
Installing your personal dotfiles on each Vagrant VM you use
View Vagrantfile
# Change this to suit your dotfiles setup and copy to your *HOST* machine: $HOME/.vagrant.d/Vagrantfile
Vagrant.configure(2) do |config|
# Mount your dotfiles to vagrant user's home folder (or wherever you want):
config.vm.synced_folder "#{ENV['HOME']}/dotfiles", '/home/vagrant/dotfiles'
# Install dotfiles on every 'vagrant provision' call.
# For example, let's imagine your your dotfiles have 'install.sh' script:
config.vm.provision 'shell', privileged: false, inline: '/home/vagrant/dotfiles/install.sh'
end
@tadas-s
tadas-s / index.html
Last active Oct 26, 2015 — forked from alexkalderimis/index.html
Custom mode RefME widget example
View index.html
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<title>RefME Cite Button</title>
<script src="https://widget.refme-dev.com/scripts/refme-cite.js"></script>
</head>
<body>
<section>
<div class="col">
<div id="citation-button"></div>
View nocol
#!/bin/bash
# Strips colors/escape sequences from output
#
# Usage: annoying-color-producing-tool | nocol
sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"
@tadas-s
tadas-s / gist:c247ac75e6418871455c
Created Nov 19, 2014
AngularJS + ui-router debug snippet
View gist:c247ac75e6418871455c
app.run(function($rootScope) {
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
console.group('$stateChangeStart ' + fromState.name + ' => ' + toState.name);
console.group('from:');
console.log(fromState);
console.log(fromParams);
console.groupEnd();
@tadas-s
tadas-s / debug_recipes.txt
Last active Aug 8, 2017
Debug recipes for Linux
View debug_recipes.txt
# Quick debug network traffic between nginx and php-fpm
# Got from:
# http://systembash.com/content/simple-sysadmin-trick-using-tcpdump-to-sniff-web-server-traffic/
# Just a flow of everything looking like a string
tcpdump -nl -w - -i eth0 -c 500 port 9090 | strings
# Request heads
sudo tcpdump -nl -w - -i eth0 -c 500 port 9090 | strings | grep -E -A5 "^(GET|PUT|POST) "
# strace processes/sub-processes
@tadas-s
tadas-s / gist:dae6a8f506993da19993
Created Jul 7, 2014
xdebug cli script from vagrant machine
View gist:dae6a8f506993da19993
# Say project domain in PhpStorm is configured as example.org and your VM IP is xxx.xxx.xxx.yyy:
PHP_IDE_CONFIG=serverName=example.org php -dxdebug.remote_autostart=1 -dxdebug.remote_host=xxx.xxx.xxx.1 -f ./app/console.php -- console:args --go-here
# with xdebug log (useful for troubleshooting)
PHP_IDE_CONFIG=serverName=example.org php -dxdebug.remote_log="./xdebug.log" -dxdebug.remote_autostart=1 -dxdebug.remote_host=xxx.xxx.xxx.1 -f ./app/console.php -- console:args --go-here
@tadas-s
tadas-s / AppKernel.php
Last active Aug 29, 2015
Relocate tmp folder on Symfony2
View AppKernel.php
<?php
use Symfony\Component\HttpKernel\Kernel;
class AppKernel extends Kernel
{
/* ... everything else is skipped ... */
public function getCacheDir()
@tadas-s
tadas-s / www-data-writeable.sh
Last active Aug 29, 2015
www-data-writeable
View www-data-writeable.sh
#!/bin/bash
#
# Sets-up ACL for current + www-data users to allow writing to folder by both and deleting files created by each other.
# This simplifies some Symfony2 dev tasks
#
# *** NOT TO BE USED IN PRODUCTION SERVERS IN ANY WAY ***.
#
if [ -z "$1" ]; then
View url_helpers_in_test_patch.rb
if Rails.env.test?
module ActionDispatch
module Routing
module UrlFor
alias_method :original_url_options, :url_options
def url_options
if self.respond_to? :request
original_url_options.merge({:host => request.host, :port => request.port})
else
View output.txt
<?php
$json = array(
'values' => array(
0 => array(
'field' => 'id1',
'value' => 895
),
1 => array(
'field' => 'id2',
You can’t perform that action at this time.