Skip to content

Instantly share code, notes, and snippets.

@oniksfly
oniksfly / backup.sh
Created Mar 11, 2018
Backup PostreSQL database from docker container
View backup.sh
# /bin/bash
echo "Backup script is running"
PG_DOCKER_CONTAINER="postgres"
PG_USERNAME="postgres"
DATABASE="default_database"
HOMEPATH=$(cd ~ && pwd)
COLOR_NORMAL="\033[0m"
@oniksfly
oniksfly / ios_tcpdump.sh
Last active Nov 28, 2017
Get TCP dump for iOS device
View ios_tcpdump.sh
# 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
oniksfly / terminate.sh
Last active Aug 16, 2017
Terminate postres DB connections
View terminate.sh
psql -c "SELECT *, pg_terminate_backend(pid) FROM pg_stat_activity WHERE pid <> pg_backend_pid() AND datname = 'DATABASE_NAME'"
@oniksfly
oniksfly / serp-position-google.js
Last active Aug 29, 2015
SERP site position bookmarklet
View serp-position-google.js
function getUrlParameter(sParam){var sPageURL = window.location.search.substring(1);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
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
oniksfly / mysql_drop_all_tables.sh
Last active Aug 29, 2015
CLI MySQL drop all tables
View mysql_drop_all_tables.sh
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.