Skip to content

Instantly share code, notes, and snippets.

@enisozgen
enisozgen / focusEmacs.sh
Created November 3, 2015 13:14
Focus emacs from everywhere
#!/bin/bash
#if emacs is running focus emacs
#else run emacs
if [ $(wmctrl -l | grep XXX--Emacs--XXX | awk '{ print $4 }') == XXX--Emacs--XXX ]; then
#you should put this line to your init.el or .emacs file
#(setq frame-title-format "XXX--Emacs--XXX")
wmctrl -a XXX--Emacs--XXX
@enisozgen
enisozgen / turengSearch.el
Created December 1, 2015 10:01
Easy Tureng english<=>turkish search from emacs
(defun TurengSearch ()
"Tureng search"
(interactive)
(browse-url
(concat
"http://tureng.com/en/turkish-english/"
(url-hexify-string (if mark-active
(buffer-substring (region-beginning) (region-end))
(read-string "Search Tureng: "))))))
@enisozgen
enisozgen / EasyOCRtoClipboard.sh
Last active February 13, 2016 19:31
Quick script that convert image to text in GNOME
#!/bin/bash
# Small script that works on GNOME as OCR to text
# Install
# sudo apt-get install tesseract-ocr
# sudo apt-get install xsel
# Usage
# Bound shortcut(Ctrl-Alt-Z) from GNOME settings
@enisozgen
enisozgen / SayTodayTasks.tsk.xml
Last active November 1, 2021 23:17
Tasker task which is read today tasks from Google Calendar
<TaskerData sr="" dvi="1" tv="4.8u1">
<Task sr="task18">
<cdate>1369143331769</cdate>
<edate>1454785550311</edate>
<id>18</id>
<nme>Say Today Tasks</nme>
<pri>100</pri>
<Action sr="act0" ve="7">
<code>547</code>
<Str sr="arg0" ve="3">%newline1</Str>
@enisozgen
enisozgen / SwitchBetweenSpesificBuffers.sh
Last active April 5, 2016 11:08
SwitchBetweenSpesificBuffers.sh
#!/bin/bash
# Copied from http://askubuntu.com/questions/269574/wmctrl-focus-most-recent-window-of-an-app
# Usage
# Download wmctrl by using apt-get or yum
# Bound shortcut that sh code from your environment
# If you press more than one it will change windows
app_name=APPNAME
workspace_number=`wmctrl -d | grep '\*' | cut -d' ' -f 1`
@enisozgen
enisozgen / is_command_exist.yml
Last active May 8, 2024 02:47
ansible tasks that Checks if a program exists from a Bash script
- name: Check is rvm installed
shell: command -v rvm >/dev/null 2>&1
register: is_rvm_exist
ignore_errors: yes
- debug: msg="{{ is_rvm_exist.rc }}" # it returns rc 1
- debug: var=is_rvm_exist
- name: Check is ls installed
shell: command -v ls >/dev/null 2>&1
@enisozgen
enisozgen / CalculateEBSVolumes.sh
Last active February 20, 2017 11:35
Show all EBS volumes size by filtering any environment
# Shows all volumes of any environment
REGION='us-east-1'
VOLUMES=$(aws ec2 describe-instances --region=$REGION --query 'Reservations[*].Instances[*].BlockDeviceMappings[*].Ebs' --filter "Name=tag:Environment,Values=Uat" --output text | awk '{print($4)}')
echo "Your volumes $VOLUMES"
for VOLUME in $VOLUMES
; I don't know where I stole it but it works well
(defun open-terminal-pop-project-root ()
(interactive)
(do-applescript
(format "
tell application \"iTerm 2\"
tell current window
tell current session
write text \"cd %s\"
end tell
@enisozgen
enisozgen / hydra-git-gutter.el
Created April 22, 2017 10:34
Nice diff's gonna save your time
;; Few changes to https://github.com/abo-abo/hydra/wiki/Git-gutter
(defhydra hydra-git-gutter (:body-pre
(save-buffer)
(git-gutter-mode 1)
:hint nil
:color blue)
"
Git gutter:
_n_: next hunk _s_tage hunk _u_ndo _r_edo _q_uit
_p_: previous hunk _R_evert hunk ^ ^ _Q_uit and deactivate git-gutter
@enisozgen
enisozgen / ansible-nested-variable.yml
Last active November 4, 2023 10:21
Ansible example which shows how to reach nested variable with dynamic elements
# Example which shows how to reach nested ansible variable which is partially different.
# Run that plabook with ansible-playbook -e "env=test" ansible-nested-variable.yml
---
#
- hosts: localhost
connection : ssh
gather_facts: no
vars:
cidr_blocks:
vpc_production_cidr_block: "10.10.0.0/28"