Skip to content

Instantly share code, notes, and snippets.

@realsby
realsby / command.sh
Created January 3, 2020 15:41
Upgrade Postgresql 9.4 to 9.6 on Debian 9
sudo nano /etc/apt/sources.list
deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo aptitude install postgresql-9.6
pg_lsclusters
sudo pg_dropcluster 9.6 main --stop
pg_lsclusters
sudo service postgresql status
sudo service postgresql stop
@realsby
realsby / howto.shell
Created May 29, 2019 23:49
optimize gltf files
npm install -g gltf-pipeline
https://github.com/AnalyticalGraphicsInc/gltf-pipeline
# re-pack the model into a GLB, adding Draco compression
gltf-pipeline -i orginal.gltf -o optimized.glb --binary --draco
gltf-pipeline -i optimized.glb -o tmp/tmp.gltf --separate --json
# optimize the textures in tmp/
@realsby
realsby / sublime_info.txt
Last active October 16, 2019 11:37
Sublime Ayarlarim
{
"bootstrapped": true,
"in_process_packages":
[
],
"installed_packages":
[
"All Autocomplete",
"Anaconda",
"ApplySyntax",
@realsby
realsby / notes.sh
Created October 24, 2018 13:02
Make package and relase it
pip install twine
python setup.py sdist
twine upload dist/PACKAGE-1.1.0.tar.gz -u realsby -p Bassword
@realsby
realsby / django_south.md
Last active October 2, 2018 07:46
South Migration Notes

Using south

  1. setup the model

python manage.py schemamigration models --initial

  1. dump data if you have to

python manage.py dumpdata -e contenttypes -e auth.Permission --natural > data.json

  1. syncdb
@realsby
realsby / webserver.conf
Last active November 25, 2018 20:38
Apache and Nginx Headers Policies Samples
Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains; preload"
Header set Content-Security-Policy "script-src * 'unsafe-inline' 'unsafe-eval'; style-src * 'unsafe-inline'; img-src * data: blob: 'unsafe-inline'; connect-src * 'unsafe-inline'; frame-src 'self' *.domain.com;"
Header always set X-Frame-Options "sameorigin"
Header set X-XSS-Protection "1"
Header set Referrer-Policy "no-referrer-when-downgrade"
Header set Feature-Policy "microphone none;camera none;"
Header set X-Content-Type-Options "nosniff"
add_header Strict-Transport-Security max-age=63072000;
add_header Content-Security-Policy "script-src * 'unsafe-inline' 'unsafe-eval'; style-src * 'unsafe-inline'; img-src * data: blob: 'unsafe-inline'; connect-src * 'unsafe-inline'; frame-src 'self' *.domain.com;";
@realsby
realsby / docker_machines_env.sh
Last active July 23, 2018 13:06
Postgresql and Redis with Docker
Docker shellden cikmak icin: ctrl + D
docker network create --driver bridge docker-network1
container icindeki postgresql portu 5432, container disinda gercek bilgisayarda 4321 den oraya erisimi aciyoruz.
docker run --name postgres1 --network docker-network1 -v /tmp/pgdata:/var/lib/postgresql/data -p 4321:5432 -e POSTGRES_PASSWORD=PPPPASSWORDDDDD -d postgres:9.6.9
docker run -it --rm --network docker-network1 postgres:9.6.9 psql -h postgres1 -U postgres
docker run -it --rm --network docker-network1 postgres:9.6.9 /bin/bash
silmek icin:
docker stop postgres1 && docker rm postgres1
@realsby
realsby / notes.sh
Last active July 13, 2018 16:08
Log arama ve yazdirma
Aşağıdaki kod text.file içinde belirli bir metini arar ve kaçıncı satırlarda yer aldığını basar.
grep -n Text_Metin text.file
Aşağıdaki kod text.file daki 6453 üncü satır ve öncesindeki 3 satırı (toplamda 4 satırı) basar.
head -n 6453 text.file | tail -n 4
Binrotada şunlara baktım:
grep -n MAL_ /var/log/uwsgi/binrota_pro.log
@realsby
realsby / wget.sh
Last active July 12, 2018 21:07
Download website with wget
wget --adjust-extension --span-hosts --convert-links --backup-converted --page-requisites --no-parent https://tr.sputniknews.com
wget --span-hosts --backup-converted --page-requisites --no-parent --content-disposition https://tr.sputniknews.com
file qs.sh
-------
# /bin/bash
for i in `find $1 -type f`
do
mv $i `echo $i | cut -d? -f1`
done
@realsby
realsby / how_export_files_from_css.txt
Created July 12, 2018 18:57
CSS Source Files Links Export
Regex:
(?:url\(|<(?:link|script|img)[^>]+(?:src|href)\s*=\s*)(?!['"]?(?:data|http))['"]?([^'"\)\s>]+)
Use:
https://regexr.com/
Paste your text and click List button.