Skip to content

Instantly share code, notes, and snippets.

View saitgulmez's full-sized avatar

Mehmet Sait Gülmez saitgulmez

View GitHub Profile
@saitgulmez
saitgulmez / vector_cpp_stl.md
Created May 4, 2025 05:45 — forked from chizhang529/vector_cpp_stl.md
Essentials of Vectors in C++ STL

1. Initialization

  • Declaring an empty vector and then pushing values
// creates an empty vector
std::vector<int> vec;
// push values into vector
vec.push_back(10);
vec.push_back(20);
vec.push_back(30);
OK, Let's begin. Hello, Everybody.
My name is Narihiro Nakamura.
Today, I'm talking about "Parallel worlds of CRuby's GC".
I'm very happy now, because I'm meeting attendee in rubyconf.
And, one of my dreams is to talk in rubyconf.
So, I'm very happy and exciting.
Today is my first presentation in English.
My English is not good.
@saitgulmez
saitgulmez / clean_code.md
Created November 28, 2022 14:32 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@saitgulmez
saitgulmez / twos_complement.rb
Created September 11, 2022 21:31 — forked from tuzz/twos_complement.rb
Encode and Decode integers to and from twos complement in Ruby
module TwosComplement
def self.encode(n)
if n < 0
binary = (n + 1).abs.to_s(2).chars.map { |c| c == "0" }
binary.unshift(true) unless binary.first == true
else
binary = n.to_s(2).chars.map { |c| c == "1" }
binary.unshift(false) unless binary.first == false
end
@saitgulmez
saitgulmez / twos_complement.rb
Created September 11, 2022 21:31 — forked from tuzz/twos_complement.rb
Encode and Decode integers to and from twos complement in Ruby
module TwosComplement
def self.encode(n)
if n < 0
binary = (n + 1).abs.to_s(2).chars.map { |c| c == "0" }
binary.unshift(true) unless binary.first == true
else
binary = n.to_s(2).chars.map { |c| c == "1" }
binary.unshift(false) unless binary.first == false
end
@saitgulmez
saitgulmez / yardoc_cheatsheet.md
Created January 27, 2022 17:57 — forked from chetan/yardoc_cheatsheet.md
YARD cheatsheet
@saitgulmez
saitgulmez / threePipeDemo.c
Created March 8, 2020 17:17 — forked from mplewis/threePipeDemo.c
Here's an example of how to pipe three commands together using C. This one uses `ps aux | grep root | grep sbin`. This topic is horribly documented online so hopefully this'll help someone else out.
// This program is an example of how to run a command such as
// ps aux | grep root | grep sbin
// using C and Unix.
#include <stdlib.h>
#include <unistd.h>
int pid;
int pipe1[2];
int pipe2[2];
@saitgulmez
saitgulmez / Freenode Registration Help.md
Created April 19, 2019 20:57
Here'e an example of how to register a nickname on Freenode IRC.

Here'e an example of how to register a nick on Freenode IRC. It's a little tricky, but if you follow some simple steps, you'll get through it okay. All you need to do is connect to the Freenode IRC network and have a little talk with NickServ.

The first and most confusing questions can be combined:

  1. How do I know if my nick is already registered to someone else?
  2. How do I talk to NickServ?

Start by connecting your client to irc.freenode.net and joining any chat.

Next, type this command in the chat window:

@saitgulmez
saitgulmez / cheat_sheet.txt
Created March 17, 2018 18:42
GDB cheat sheet
GDB commands by function - simple guide
---------------------------------------
More important commands have a (*) by them.
Startup
% gdb -help print startup help, show switches
*% gdb object normal debug
*% gdb object core core debug (must specify core file)
%% gdb object pid attach to running process
% gdb use file command to load object
@saitgulmez
saitgulmez / 0_reuse_code.js
Created August 4, 2017 17:49
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console