Skip to content

Instantly share code, notes, and snippets.

Halil Özgür halilim

Block or report user

Report or block halilim

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@halilim
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(
keyword.toLowerCase()
);
});
if (confirm(`Search engines: \
${document.querySelectorAll("#default-search-engine-list .deletable-item").length} default, \
@halilim
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 halil.im 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
halilim / check.md
Last active Nov 2, 2016
Text editor color theme checking guides - open the files in your editor and try out different color schemes
View check.md

Should style Markdown headers

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

Should highlight code blocks:

View find_uniq.rb
require 'set'
def find_uniq(ids)
# O(n) space
# uniqs = Set.new
# ids.each do |id|
# uniqs.delete(id) unless uniqs.add?(id)
# end
# uniqs.first
# O(1) space
@halilim
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)
end
end
def base.method_added(method)
TraceCalls.run_method_added(self, method, __method__)
@halilim
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
end
module InstanceMethods # :nodoc:
def hello
puts 'hello from Extendable'
super
end
@halilim
halilim / move_heroku_pg_to_aws_rds.md
Last active Jun 12, 2019
Move Heroku Postgres to Amazon AWS RDS
View move_heroku_pg_to_aws_rds.md
  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:

View keybase.md

Keybase proof

I hereby claim:

  • I am halilim on github.
  • I am halil (https://keybase.io/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
REVERSE_CIPHER = CIPHER.invert.freeze
@halilim
halilim / assets.rb
Created Jan 16, 2016
A working CDN config for galetahub/ckeditor which doesn't copy/precompile CKEditor's own assets.
View assets.rb
# config/initializers/assets.rb
# ...
# The last two are for the file browser
Rails.application.config.assets.precompile += %w(ckeditor/config ckeditor/application ckeditor/filebrowser/*)
You can’t perform that action at this time.