Skip to content

Instantly share code, notes, and snippets.

View mehmetboraezer's full-sized avatar

Mehmet Bora Ezer mehmetboraezer

View GitHub Profile
@mehmetboraezer
mehmetboraezer / generate.sh
Last active October 13, 2016 20:13
Random name generator for OS X
#!/bin/sh
# Run the script as root
MACHINE_ID=$RANDOM
scutil --set ComputerName $MACHINE_ID
scutil --set LocalHostName $MACHINE_ID
scutil --set HostName $MACHINE_ID
@mehmetboraezer
mehmetboraezer / memory.py
Last active October 13, 2016 20:13
Memory monitor for OS X
#!/usr/bin/python
import subprocess
import re
# Get process info
ps = subprocess.Popen(['ps', '-caxm', '-orss,comm'], stdout=subprocess.PIPE).communicate()[0]
vm = subprocess.Popen(['vm_stat'], stdout=subprocess.PIPE).communicate()[0]
# Iterate processes
@mehmetboraezer
mehmetboraezer / generator.md
Last active November 15, 2020 17:26
google authenticator alternative for cli

This flow is used to generate passcode on command-line in two-step verification.

OSX

  • Install brew

  • Install oath

brew install oath-toolkit

@mehmetboraezer
mehmetboraezer / appium.md
Created March 17, 2017 16:41
Appium iOS Environment Setup Steps without GUI

Appium iOS Environment Setup Steps

After Installation OSX

  • Remove unnecessary dock items.

  • Allow remote login (ssh) and screen sharing on system preferences.

iTunes Configuration

@mehmetboraezer
mehmetboraezer / permission.md
Last active March 23, 2017 13:53
Resolve of the permission denied error in Brew
sudo chown -R "$USER":admin /usr/local
sudo chown -R "$USER":admin /Library/Caches/Homebrew
@mehmetboraezer
mehmetboraezer / read-only.sql
Created April 26, 2017 08:17
Create read-only user for postgresql
CREATE ROLE 'new_username' WITH LOGIN PASSWORD 'new_password' NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION VALID UNTIL 'infinity';
GRANT CONNECT ON DATABASE 'db_name' TO 'new_username';
GRANT USAGE ON SCHEMA public TO 'new_username';
GRANT SELECT ON ALL TABLES IN SCHEMA public TO 'new_username';
GRANT SELECT ON ALL SEQUENCES IN SCHEMA public TO 'new_username';
GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA public TO 'new_username';
# This gist is compatible with Ansible 1.x .
# For Ansible 2.x , please check out:
# - https://gist.github.com/dmsimard/cd706de198c85a8255f6
# - https://github.com/n0ts/ansible-human_log
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
@mehmetboraezer
mehmetboraezer / fstrim
Created June 22, 2017 22:07
/etc/cron.daily/fstrim
#!/bin/sh
LOG=/var/log/fstrim/trim.log
echo "Starting trim $(date -R) " >> $LOG
fstrim -v -a >> $LOG
  • create new cron script

     touch /etc/cron.daily/cleanup
    
  • set executable permission

sudo chmod +x /etc/cron.daily/cleanup