Skip to content

Instantly share code, notes, and snippets.


Halil Özgür halilim

View GitHub Profile
halilim /
Last active Jul 14, 2020
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.


# TODO: Add steps for Zsh & oh-my-zsh:
git clone ~/termux_gist
bash ~/termux_gist/
halilim / Chrome_remove_auto_search_engines.js
Last active Jul 4, 2017
Remove automatically created search engines from Chrome.
View Chrome_remove_auto_search_engines.js
var others = document.querySelectorAll("#other-search-engine-list .deletable-item:not([lead=lead])");
var toBeRemoved = [...others].filter(function(listItem) {
var keyword = listItem.querySelector(".keyword-column .static-text").innerText;
return keyword.includes(".") &&
listItem.querySelector(".url-column .static-text").innerText.toLowerCase().includes(
if (confirm(`Search engines: \
${document.querySelectorAll("#default-search-engine-list .deletable-item").length} default, \
halilim / daily_whois_halil_im.js
Last active May 24, 2017
Simple AWS Lambda script to notify by SNS if a domain is expiring within 3 days
View daily_whois_halil_im.js
// Simple AWS Lambda function to notify if the domain is expiring within 3 days.
// Tested on Node.js 6.10 runtime.
// * Create an SNS topic and an SNS subscription with the email you want to be notified
// * Create the function with a trigger of "CloudWatch Events - Schedule" with rate: 1 day
// * Provide the SNS topic ARN to the function as an environment variable
// * Create and attach a policy to the role of this function with sns:Publish on the SNS topic ARN
// (logs:CreateLogGroup, logs:CreateLogStream & logs:PutLogEvents on a logs ARN should already be there)
/* eslint-env node,es6 */
/* eslint no-console: "off" */
halilim /
Last active Jul 14, 2020
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
View find_uniq.rb
require 'set'
def find_uniq(ids)
# O(n) space
# uniqs =
# ids.each do |id|
# uniqs.delete(id) unless uniqs.add?(id)
# end
# uniqs.first
# O(1) space
halilim / trace_calls.rb
Created Mar 21, 2016
A refactoring of TraceCalls (Metaprogramming - Programming Ruby 1.9 & 2.0, 4th edition)
View trace_calls.rb
module TraceCalls
def self.included(base)
[base, base.singleton_class].each do |klass|
klass.instance_methods(false).each do |existing_method|
wrap(klass, existing_method)
def base.method_added(method)
TraceCalls.run_method_added(self, method, __method__)
halilim / inheritance_hierarchy.rb
Last active Aug 20, 2016
Demonstrating Ruby class/module method inheritance hierarcy
View inheritance_hierarchy.rb
module Extendable # :nodoc:
def self.extended(base)
base.include InstanceMethods
module InstanceMethods # :nodoc:
def hello
puts 'hello from Extendable'
halilim /
Last active Feb 8, 2020
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:


Keybase proof

I hereby claim:

  • I am halilim on github.
  • I am halil ( on keybase.
  • I have a public key ASCTFoy6Tqz9aQRrOCeOjMkn9M_xyoPNpU3g5_mbYMCpTgo

To claim this, I am signing this object:

View ruby_cryptology.rb
CIPHER = { 'a' => 'n', 'b' => 'o', 'c' => 'p', 'd' => 'q',
'e' => 'r', 'f' => 's', 'g' => 't', 'h' => 'u',
'i' => 'v', 'j' => 'w', 'k' => 'x', 'l' => 'y',
'm' => 'z', 'n' => 'a', 'o' => 'b', 'p' => 'c',
'q' => 'd', 'r' => 'e', 's' => 'f', 't' => 'g',
'u' => 'h', 'v' => 'i', 'w' => 'j', 'x' => 'k',
'y' => 'l', 'z' => 'm' }.freeze
You can’t perform that action at this time.