Skip to content

Instantly share code, notes, and snippets.

View sbrin's full-sized avatar

Mikhail Ilin sbrin

View GitHub Profile
@sbrin
sbrin / index.html
Created January 22, 2013 12:45
A CodePen by A.
<form id="mailform" action="#" method="post">
<textarea name="message" placeholder="Текст тут какой-надо"></textarea>
<br>
<input id="mailbuttom" type="submit" value="Отправить">
</form>
<p id="mailsuccess" style="display:none">Заебись, отправил!</p>
@sbrin
sbrin / urldecode.sh
Created February 4, 2013 16:07
urldecode cyrillic -> utf8
#!/bin/bash
echo $1 | perl -MURI::Escape -lne 'print uri_unescape($_)'
@sbrin
sbrin / replace
Created February 4, 2013 16:09
Замена фрагмента текста (string replace)
find . -type f -name "index*" | xargs perl -pi~ -e "s/PREV/REPLACE/ig"
@sbrin
sbrin / gist:5635828
Created May 23, 2013 12:53
Copy website (wget recursive crawler)
wget -w 1 -r --no-clobber --page-requisites --html-extension --convert-links --restrict-file-names=windows --domains DOMAIN --no-parent FOLDER/
@sbrin
sbrin / gist:5927664
Last active December 19, 2015 08:39
Wget sitemap spider
wget --spider -o wget.log -e robots=off --wait 3 -r -p -S http://
grep -ri 'http://' wget.log | grep -E -v '(files/|\.jpg|\.jpeg|\.gif|\.css|\.js|\.pdf|\.png|\.xls)' | awk '{print $3}'|sort|uniq|sort > site_map.txt
cat $1 |grep -i -E -v '(\.jpg|\.jpeg|\.gif|\.css|\.js|\.pdf|\.png|\.xls|\.ico|\.txt|\.doc|yandexbot|googlebot|YandexDirect|\/upload\/|" 404 |" 301 |" 302 )'|perl -MURI::Escape -lne 'print uri_unescape($_)'|grep yandsearch|awk '{print $1}'|sort|uniq|wc -l
@sbrin
sbrin / gist:6605987
Created September 18, 2013 07:55
bash FOR loop variables to skip spaces
OIFS="$IFS"
IFS=$'\n'
@sbrin
sbrin / index.html
Last active February 10, 2023 22:23
Paste MS Word Text Jquery plugin
<!DOCTYPE html>
<html>
<body>
<div id="src">Source here...</div>
<div id="editor" contenteditable="true">
<p>Place MS-Word text here...</p>
</div>
</body>
</html>
@sbrin
sbrin / saveLog.php
Created November 24, 2014 16:28
simple php logging
function saveLog( $data )
{
$logname = date("Ymd") . ".log.txt";
$handle = fopen($logname, "a+");
if ($handle !== false) {
fwrite($handle, $data . PHP_EOL);
fclose($handle);
} else {
throw new Exception("saveLog fopen error");
@sbrin
sbrin / rsync.sh
Last active February 15, 2016 12:07
rsync -av --ignore-existing --exclude-from '[excludefile]' [srcpath] [dstpath]
@sbrin
sbrin / popover_simple.js
Last active October 25, 2016 19:59
jQuery simple popover hides on click anywhere beside itself
$(function () {
var pop = {};
pop.shown = false;
pop.item = $('.popover');
$('body').on('click', function(e){
if ( e.target.className == 'button-block' ){
if ( pop.shown == true ){
pop.item.hide();
pop.shown = false;