Skip to content

Instantly share code, notes, and snippets.

View ozgun's full-sized avatar

Ozgun Koyun ozgun

View GitHub Profile
@ozgun
ozgun / GeziParki.java
Created June 4, 2013 11:17
Java öğreniyorum da bu aralar..
interface Direnebilme {
public void diren();
}
interface HakkiniArayabilme {
public void hakkiniAra();
}
interface BariscilEylemYapabilme {
public void bariscilEylemYap();
public class DowncastingExample {
public static void main(String args[]) {
Object[] o = new Object[2];
o[0] = new Hayvan(); // upcasting
o[1] = new Kedi(); // upcasting
Hayvan a2 = (Hayvan) o[0]; // downcasting
Kedi a3 = (Kedi) o[1]; // downcasting
public class DowncastingExample {
public static void main(String args[]) {
Object a = new Hayvan();
Hayvan b = (Hayvan) a; // aşağıya çevirim, downcasting
}
}
@ozgun
ozgun / c.c
Created March 21, 2013 12:42
c
void rb_define_method(VALUE klass, const char *name, VALUE (*func)(), int argc)
@ozgun
ozgun / sinatra-rack-app.rb
Last active December 14, 2015 14:08
Simple sinatra rack app
class AuthApi < Sinatra::Base
get 'ping' do
"pong"
end
get 'ping2' do
"pong2"
end
@ozgun
ozgun / README
Last active December 11, 2015 21:29
datepicker + timepicker + range + localication + Rails
app/assets/javascripts/admin klasöründe olması gereken js dosyaları:
# jquery-ui-i18n.min.js
# jquery-ui-sliderAccess.js (timepicker)
# jquery-ui-timepicker-addon.js (timepicker)
# jquery-ui-timepicker-tr.js (timepicker)
Timepicker: https://github.com/trentrichardson/jQuery-Timepicker-Addon
app/assets/images/admin/images klasöründe olması gereken resim dosyaları:
@ozgun
ozgun / dhclient.conf
Created January 27, 2013 12:46
dhcp ile IP alınırken /etc/resolv.conf dosyasına ilgili IP'lerin eklenmesi
...
prepend domain-name-servers 127.0.0.1, 8.8.8.8, 8.8.4.4, 208.67.222.222, 208.67.220.220, 208.67.222.220, 208.67.220.222;
...
@ozgun
ozgun / bson_object_id.txt
Created January 25, 2013 10:31
BSON:ObjectId('5101b247c0a8050e1496f7fa')
# BSON::ObjectId('5101b247c0a8050e1496f7fa')
#
# 5101b247 c0a8050e 1496 f7fa
#
# * timtestamp = 0x5101b247 # => 1359065671
# * src_ip = 0xc0a8050e # => 192.168.5.14
# * src_port = 0x1496 # => 5270
# * dst_port = 0xf7fa # => 63482
@ozgun
ozgun / generate_ts.rb
Last active December 11, 2015 15:29
Generating timestamps with mongo Ruby driver (Ruby code)
# encoding: utf-8
require 'json'
require 'mongo'
@conn = Mongo::Connection.new("localhost", 27017, safe: true)
@db = @conn['timestamp_test']
@coll = @db['test_col']
@coll.save({a: BSON::Timestamp.new(4294967295, 4294967295)})
@ozgun
ozgun / timestamp.txt
Created January 24, 2013 12:40
timestamp generated with mongo Ruby driver
> db.test_col.find()
{ "_id" : ObjectId("51012a6d8d74494bd8000001"), "a" : Timestamp(4294967295000, 4294967295) }