Skip to content

Instantly share code, notes, and snippets.

oniksfly /
Created Mar 11, 2018
Backup PostreSQL database from docker container
# /bin/bash
echo "Backup script is running"
HOMEPATH=$(cd ~ && pwd)
oniksfly /
Last active Nov 28, 2017
Get TCP dump for iOS device
# Attach iOS device to Mac and create virtual network
# Use real iOS UUID instead placeholder
# It is possible to get UUID with iTunes: just click on `Serial number` field
rvictl -s UUID
# Returns `Starting device UUID [SUCCEEDED] with interface rviX`
# Start dumping traffic
# Use real name of virtual network instead `rviX`
# To stop use `ctrl + C`
sudo tcpdump -i rviX -w ~/ios.pcap
oniksfly /
Last active Aug 16, 2017
Terminate postres DB connections
psql -c "SELECT *, pg_terminate_backend(pid) FROM pg_stat_activity WHERE pid <> pg_backend_pid() AND datname = 'DATABASE_NAME'"
oniksfly / serp-position-google.js
Last active Aug 29, 2015
SERP site position bookmarklet
View serp-position-google.js
function getUrlParameter(sParam){var sPageURL =;var sURLVariables = sPageURL.split('&');for (var i = 0; i < sURLVariables.length; i++) {var sParameterName = sURLVariables[i].split('=');if (sParameterName[0] == sParam) {return sParameterName[1];}}}
var site_url = '';
var message = '';
var $onPageItems = jQuery('#ires .g:not(#imagebox_bigimages)');
var start = getUrlParameter('start');
if (!start) {
start = 0;
} else {
start = parseInt(start);
oniksfly / pager_all.php
Last active Aug 29, 2015
Drupal "Show all" pager
View pager_all.php
// Part of pager_all.module Drupal 7
* Implements hook_custom_theme().
function pager_all_theme() {
return array(
'pager_all' => array(
'variables' => array(),
oniksfly /
Last active Aug 29, 2015
CLI MySQL drop all tables
mysql -u DB_USER_NAME -p DB_USER_PSWD -Nse 'show tables' DATABASE_NAME | while read table; do mysql -u DB_USER_NAME -p DB_USER_PSWD -e "drop table $table" DATABASE_NAME; done
You can’t perform that action at this time.