Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# This script will kill process which running more than X hours
# egrep: the selected process; grep: hours
PIDS="`ps eaxo bsdtime,pid,comm | egrep "spamd|exim|mysqld|httpd" | grep " 1:" | awk '{print $2}'`"
# Kill the process
echo "Killing spamd, exim, mysqld and httpd processes running more than one hour..."
for i in ${PIDS}; do { echo "Killing $i"; kill -9 $i; }; done;
import commands
import re
from django.conf import settings
from geokey.applications.models import Application
from .sapelli_exceptions import SapelliException
from .sapelli_loader import get_sapelli_dir_path, get_sapelli_jar_path
#!/bin/bash
#update
sudo apt-get update && sudo apt-get upgrade
#Install Postgres and PostGIS
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" |sudo tee /etc/apt/sources.list.d/pgdg.list
sudo apt update
<VirtualHost *:80>
ServerName localhost
DocumentRoot /var/www/geokey
WSGIScriptAlias / /var/www/geokey/local_settings/wsgi.py
# adjust the following line to match your Python path
# WSGIDaemonProcess localhost processes=2 threads=15 display-name=%{GROUP} python-home=/home/django/env/lib/python2.7/ python-path=/home/django:/home/django/env/lib/python2.7/site-packages
WSGIDaemonProcess localhost processes=2 threads=15 python-home=/home/django/env/
WSGIProcessGroup localhost
WSGIApplicationGroup %{GLOBAL}
#!/bin/bash
sudo apt-get update && sudo apt-get upgrade
sudo reboot
sudo apt -y install gnupg2
#Install PostgreSQL 12 on Ubuntu 18.04
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
@karataserkan
karataserkan / node
Last active December 27, 2019 10:56
#node-saas error
sudo npm install --unsafe-perm -g node-sass
#clean & reinstall
npm cache clean --force
rm -rf node_modules
rm package-lock.json
npm install
@karataserkan
karataserkan / tools.json
Created December 12, 2019 12:32
hascking tools
{
"4nonimizer" : {
"name" : "4nonimizer",
"package_name" : "4nonimizer",
"category" : [null],
"url" : "https://github.com/Hackplayers/4nonimizer.git",
"package_manager" : "git",
"dependency" : ["git"]
},
"A-Rat" : {
@karataserkan
karataserkan / repo-rinse.sh
Created November 20, 2019 11:21 — forked from nicktoumpelis/repo-rinse.sh
Cleans and resets a git repo and its submodules
git clean -xfd
git submodule foreach --recursive git clean -xfd
git reset --hard
git submodule foreach --recursive git reset --hard
git submodule update --init --recursive
@karataserkan
karataserkan / ffmpeg
Created October 24, 2019 12:11
change volume in sound
ffmpeg -i right.wav -filter:a "volume='0.2*between(t,0,5)+(0.8*(t-5)/5)*between(t,5.01,9.99)+between(t,10,15)':eval=frame" -y out2.mp3
@karataserkan
karataserkan / gist:9aceafbe942b3d5587fe5add703a156d
Last active February 6, 2019 09:15
Shell script nth line and nth column in for loop with command parameter and awk

10 times run command and for each command waits 5 seconds. Prints human readable disk usage of /dev/sdb1

for i in {1..10}; do df -h /dev/sdb1 | awk '{ if(NR==2) print $2 " "  $3 " "  $4 " " $5}'; sleep 5; done