Skip to content

Instantly share code, notes, and snippets.

View halilim's full-sized avatar

Halil Özgür halilim

View GitHub Profile
@halilim
halilim / Homebrew OpenSSH with macOS keychain.md
Created December 29, 2023 20:50
Homebrew OpenSSH with macOS keychain

Problem:

  1. macOS (14.2.1) ssh (OpenSSH_9.4p1, LibreSSL 3.3.6) is vulnerable to Terrapin attack (as reported by the scanner).
  2. The regular OpenSSH (e.g. via Homebrew) doesn't support the UseKeychain option

Workaround:

  1. Automator > new Application > Run Shell Script: ~/bin/login-script, save as Login script.app
  2. Create a new file ~/bin/login-script with contents:
@halilim
halilim / iTerm2 subtitle.md
Created January 4, 2024 11:43
Set iTerm2 subtitle to current git folder or working directory

Put this in shell init scripts (after iterm2_shell_integration):

function iterm2_print_user_vars() {
  iterm2_set_user_var pathShort "$(iterm2_custom_path_short)"
}

function iterm2_custom_path_short() {
  local dir
 dir=$(git rev-parse --show-toplevel 2> /dev/null || pwd)
@halilim
halilim / bozuk_turkce_karakter_duzelt.php
Created September 1, 2013 18:32
Bozuk Türkçe karakter düzelt - Fix corrupt Turkish characters
<?php
function array_make_first(&$array, $element) {
if (($ndx = array_search($element, $array)) !== false) {
unset($array[$ndx]);
array_unshift($array, $element);
}
}
$encler = mb_list_encodings();
@halilim
halilim / DNS-Switcher.jse
Created September 1, 2013 14:11
Windows DNS Switcher - Switch your DNS resolvers for all network interfaces in Windows from command line.
/**
* Windows DNS Switcher - Don't wear out your mouse trying to change your DNS server adresses.
* @author Halil Ozgur
* @license GPL Licence
*/
var dnsler = [
["Empty (DHCP-Auto)", []],
["OpenDNS", ["208.67.222.222", "208.67.220.220"]],
["Google DNS", ["8.8.8.8", "8.8.4.4"]],
@halilim
halilim / My_Termux_Customizations.md
Last active November 12, 2021 23:42
My Termux customizations. Since I'm not aware of a simpler way of syncing them I just created this. They are mostly subsets of my desktop configs.

Installation

pkg install git vim
git clone https://gist.github.com/6f1c30a51577c2b0370415f210093ba1.git ~/termux_gist
bash ~/termux_gist/setup.sh

# Then, edit `~/.zshrc`:
ZSH_THEME="sunaku"
@halilim
halilim / Envoy.blade.php
Last active March 20, 2021 04:36
Sample Envoy tasks for a Laravel project. - http://laravel.com/docs/ssh - https://github.com/laravel/envoy
* -A in SSH enables agent forwarding.
* -p 2122 is not needed if you use the default port of 22.
* Replace SSH_USER and example.com with your own values.
* Example run: $ envoy run deploy_demo
* --no-scripts because Laravel composer.json's post-install-cmd includes optimize, which is already done by php artisan dump-autoload
@servers(['test' => '-A -p 2122 -l user test.example.com', 'prod' => '-A -p 2122 -l user example.com'])
@task('install_test', ['on' => ['test']])
cd project
@halilim
halilim / move_heroku_pg_to_aws_rds.md
Last active February 22, 2021 14:13
Move Heroku Postgres to Amazon AWS RDS
  1. Prepare your RDS instance and [authorize access to it][1] (basically make it public).

  2. Put your app in maintenance mode:

    heroku maintenance:on
  3. Save the latest SQL dump of the DB:

@halilim
halilim / check.md
Last active July 14, 2020 20:49
Text editor color theme test

(Open the files in your editor and try out different color schemes)

It should highlight Markdown headers

It should handle basic styling like inline code, italic text, bold text, but should not italicize_inline under_lined text.

  • A list item
  • Some inline code
  • Etc lorem ipsum
@halilim
halilim / zsh-debug-startup.sh
Created August 21, 2014 14:13
List zsh startup scripts line by line verbosely
zsh -x 2>&1
@halilim
halilim / rails_admin.tr.yml
Last active September 28, 2019 10:17 — forked from paracycle/rails_admin.tr.yml
rails_admin tr locale
tr:
admin:
js:
true: Doğru
false: Yanlış
is_present: Mevcut
is_blank: Boş
date: Tarih ...
between_and_: ... ile ... arası
today: Bugün