Skip to content

Instantly share code, notes, and snippets.

View TheRatG's full-sized avatar
🐭
be balanced

Vladimir Pak TheRatG

🐭
be balanced
View GitHub Profile
@TheRatG
TheRatG / git tricks
Last active October 24, 2022 06:00
Чтобы git работал на нашей виртуозе
git config --global http.sslVerify false
```
#~/.gitconfig
[alias]
co = checkout
br = branch
ci = commit
st = status
hist = log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
type = cat-file -t
@TheRatG
TheRatG / mod_proxy
Last active September 19, 2018 18:13
mod_proxy
http://www.hackersgarage.com/install-mod_proxy-apache-module-on-whmcpanel-ceentos-linux-server.html
Installation :
Check Apache current version :
/usr/local/apache/bin/httpd -v
Output :
Server version: Apache/2.2.19 (Unix)
@TheRatG
TheRatG / git revert
Created December 17, 2012 08:02
git revert
Try this first:
git checkout master
(If you're on a different branch than master, use the branch name there instead.)
If that doesn't work, try...
For a single file:
git checkout HEAD /path/to/file
@TheRatG
TheRatG / Find and replace
Last active December 9, 2015 23:49
Find and replace
find ./ -type f -exec sed -i 's/find/replace/g' {} \;
Run all tests
```python
#file __init__.py
def load_tests(loader, standard_tests, pattern):
# top level directory cached on loader instance
this_dir = os.path.dirname(__file__) + '/tests'
package_tests = loader.discover(start_dir=this_dir, pattern=pattern)
standard_tests.addTests(package_tests)
return standard_tests
```
@TheRatG
TheRatG / gist:8612616
Created January 25, 2014 06:36
Disable cache file
What you're seeing is probably because the server serving the static files is using the "sendfile()" syscall, which is broken with the VirtualBox file system. You need to disable sendfile() usage in your server. For Apache:
EnableSendfile off
And for nginx:
sendfile off;
@TheRatG
TheRatG / perl replace
Last active August 29, 2015 14:07
perl replace
perl -i -p -e 's/search/replace/' filename;
@TheRatG
TheRatG / chmod
Last active August 29, 2015 14:08
Uni read privileges
find <folder> -type d -exec chmod 755 {} \;
find <folder> -type f -exec chmod 644 {} \;
@TheRatG
TheRatG / find and size
Last active January 27, 2016 07:38
find and size
# find old files and calculate their size in Mb
find ./logs/* -type f -mtime +180 -exec du -ks {} \; | cut -f1 | awk '{total=total+$1}END{print total/1024}'
@TheRatG
TheRatG / copy.php
Created February 2, 2016 09:50
symfony copy dir
$fileSystem = new Filesystem();
$fileSystem->mkdir($target);
$directoryIterator = new \RecursiveDirectoryIterator($source, \RecursiveDirectoryIterator::SKIP_DOTS);
$iterator = new \RecursiveIteratorIterator($directoryIterator, \RecursiveIteratorIterator::SELF_FIRST);
foreach ($iterator as $item) {
if ($item->isDir()) {
$targetDir = $target.DIRECTORY_SEPARATOR.$iterator->getSubPathName();
$fileSystem->mkdir($targetDir);
} else {