Skip to content

Instantly share code, notes, and snippets.

@rc5hack
rc5hack / bots.hosts
Created January 23, 2013 10:17
Variables/bots.hosts for YaBB 2.x
alexa|Alexa
ia_archiver|Alexa archiver
yandex|Яndex
YaDirectBot|Яndex direct
YandexMetrika|Яndex metrika
crawl.yahoo|Yahoo
mercator|Mercator
surveybot|SurveyBot
wisenutbot|WISENutbot
atext.com|Exite Architext Spider
/*
* Code copied from Russian wikipedia (08.02.2012)
*/
window.loadedScripts={};
window.importScriptURI=function(url){
if(loadedScripts[url]){return null;}
loadedScripts[url]=true;
var s=document.createElement('script');
/*
* This code is to insert into userspace .js file on rodovid.org project
* (e.g. http://en.rodovid.org/wk/User:YourUsername/monobook.js)
*/
(function (window) {
window.loadedUserScripts={};
window.importUserScriptURI=function(url){
if(loadedUserScripts[url]){return null;}
alert('foo bar from sandbox.js at github.com');
@rc5hack
rc5hack / restore_from_dump.sh
Created May 15, 2013 08:56
Restoring database(s) from dump, assume that *.sql contains "CREATE TABLE" statements, and *.txt contains table data. Folder name is name of database. Based on old Bookvoed's code. Syntax: cd /path/to/folders-with-dumps && ./restore_from_dump.sh database1 database2 ... databaseN
#!/usr/bin/env bash
if [ -z "$1" ]
then
echo "You should tell me where to work! I can't guess."
exit 1
fi
dir=$(pwd)
Установка в FreeBSD
---------------------------
Часть используемого ПО распространяется только в виде бинарных файлов, в связи с чем есть некоторые трудности (не найдены defluff и cryopng, не собирается pngrewrite).
```sh
## storing current dir
pushd . > /dev/null
### Installing needed ports
#!/usr/bin/perl --
use File::Find;
my $directory1 = $ARGV[0];
my $directory2 = $ARGV[1];
find(\&hashfiles, $directory1);
sub hashfiles {
@rc5hack
rc5hack / multiple_ssh_setting.md
Last active December 20, 2015 09:59 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github accounts

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"
@rc5hack
rc5hack / .bashrc
Created August 2, 2013 14:00
screen(1) stuff
alias live='
if [ -n "`screen -ls | grep LIVE`" ]; then
if [ -n "`screen -ls | grep LIVE | grep Attached`" ]; then
if [ -z "`echo $TERMCAP | grep screen`" ]; then
echo "Enter into Atached screen...";
sleep 2;
screen -x LIVE;
else
echo "Already in LIVE";
fi
@rc5hack
rc5hack / sources.c
Created August 15, 2013 08:56
C program that changes it's proctitle (works on FreeBSD).
#include <stdio.h>
#include <unistd.h> // for sleep()
// Please note, that Linux does not supports setproctitle()
// (but FreeBSD does)
int main (void) {
setproctitle("I am C program! (%d)", getpid());
int MyTick=0;