Skip to content

Instantly share code, notes, and snippets.

@ivanhub
ivanhub / git-clearHistory
Created April 1, 2019 07:00 — forked from stephenhardy/git-clearHistory
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
@ivanhub
ivanhub / ST3-Keys-Windows.txt
Created March 31, 2019 19:58
Useful ST3 WinKeys
Wrapping Paragraph: ALT-Q
Wrap Toggle: Ctrl+Shift+P (wrap)
CTRL+D : WORD
REMOVE WORDS(R): CTRL + DELETE
REMOVE WORDS(L): CTRL + BACKSPACE
REMOVE END OF THE LINE: CTRL + SHIFT + DEL
REMOVE BEGINING OF THE LINE: CTRL + SHIFT + BACKSPACKE
@ivanhub
ivanhub / android-emu-set-ip.sh
Last active March 30, 2019 21:49
Android emulator setting ip address / internet
####################################################################
############# ###############
############# ANDROID EMULATOR INTERNET SET UP ###############
############# ###############
####################################################################
#ip address add 192.168.100.77 dev eth0
ifconfig eth0 down
ifconfig eth0 192.168.100.103 netmask 255.255.255.0 up
@ivanhub
ivanhub / webhook.js.php.txt
Last active March 24, 2019 23:52
Sending Webhooks (js/php)
//SIMPLE WEBHOOK (JS):
var d = new Date()
var fd = d.getDate() + "." + ("0" + (d.getMonth() + 1)).slice(-2) + "." + d.getFullYear();
var text = "ФИО: " + $('input[name=\'aridiuscallback_firstname\']').val() +
"\nТелефон клиента: " + $('input[name=\'aridiuscallback_contact\']').val() +
"\nКомментарий: " + $('textarea[name=\'aridiuscallback_comment\']').val() +
"\nДата заказа: " + fd;
$.ajax({
type: "post",
url: "https://webhook.site/0dded8f1-47c7-4b11-9cda-9eb690aa84a7",
@ivanhub
ivanhub / backup-sql-db2ftp.sh
Last active March 24, 2019 06:26
Backup MySQL DB's to FTP
#!/bin/bash
### MySQL Server Login Info ###
MUSER="root"
MPASS="MYSQL-ROOT-PASSWORD"
MHOST="localhost"
MYSQL="$(which mysql)"
MYSQLDUMP="$(which mysqldump)"
BAK="/backup/mysql"
GZIP="$(which gzip)"
### FTP SERVER Login info ###
@ivanhub
ivanhub / ssl.create.sh
Created March 24, 2019 06:13
Creating SSL Certificates / apache / shell
SSL issues, salvation for new Chrome:
openssl req -newkey rsa:4096 -nodes -keyout key.pem -x509 -days 3650 -out certificate.pem -extensions req_ext -config ssl.conf -subj '/CN=localhost/O=Stackflow/C=US/L=Los Angeles/OU=StackflowTech'
mac os x:
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ./certificate.pem
source:
https://stackoverflow.com/questions/7580508/getting-chrome-to-accept-self-signed-localhost-certificate?rq=1
@ivanhub
ivanhub / wget-site-mirror.sh
Last active February 10, 2021 14:38
wget site mirror
https://eternallybored.org/misc/wget/ (for windows v1.20.3 - ssl support)
wget --mirror --convert-links --adjust-extension --page-requisites
--no-parent http://example.org
:
wget -mkEpnp http://example.org
wget -mkEpnp -erobots=off http://example.org
+
@ivanhub
ivanhub / BEM.Basis.txt
Last active December 25, 2017 13:05
Bem - Basis
Блок
Название блока - смысл «что это?». а не "какой", "как выглядит".
Блок не должен влиять на свое окружение, т. е. блоку не следует задавать внешнюю геометрию
(в виде отступов, границ, влияющих на размеры) и позиционирование.
Элемент
Составная часть блока, которая не может использоваться в отрыве от него.
Элемент — всегда часть блока, а не другого элемента. (нельзя block__elem1__elem2)
Название элемента - смысл «что это?». а не "какой", "как выглядит".
@ivanhub
ivanhub / jsfiddle.net-save-to-file.txt
Created December 22, 2017 09:41
Save JSFiddle.net to one file
#
# Save jsfiddle.net to one file.
#
view-source:http://fiddle.jshell.net/<fiddle_id>/show/light/
@ivanhub
ivanhub / wp-crontab-ipgeobase-update.cron
Created December 22, 2017 07:45
WP cron tab php (update ip geo base)
file_put_contents("cities.tar.gz", fopen("http://ipgeobase.ru/files/db/Main/geo_files.tar.gz", 'r'));
$p = new PharData('cities.tar.gz');
$p->decompress();
$phar = new PharData('cities.tar');
unlink('/home/r/rosakaderf/samarapb.ru/public_html/wp-content/themes/atahualpa/cities.txt');
unlink('/home/r/rosakaderf/samarapb.ru/public_html/wp-content/themes/atahualpa/cidr_optim.txt');
$phar->extractTo('/home/r/rosakaderf/samarapb.ru/public_html/wp-content/themes/atahualpa/');
$text = file_get_contents('/home/r/rosakaderf/samarapb.ru/public_html/wp-content/themes/atahualpa/cities.txt');
$text2 = iconv('WINDOWS-1251', 'UTF-8', $text);
//$text3 = file_get_contents('/home/spb8hot/public_html/wp-content/themes/atahualpa/cidr_optim.txt');