Skip to content

Instantly share code, notes, and snippets.

View fatih's full-sized avatar

Fatih Arslan fatih

View GitHub Profile
@fatih
fatih / blog_arsln_org_pointer_arithmetic.c
Created June 4, 2012 20:30
Examples of pointer arithmetics in C
#include <stdio.h>
int main(void)
{
int my_array[] = {13, 4, 9, -5, 45};
int *ptr = NULL;
puts("Now execute ptr = my_array (or ptr = &my_array[0]\n");
// Assing the the addres of my_array(which is of type pointer) to a new pointer (to ptr)
@fatih
fatih / blog_arsln_org_pointer_arithmetic2.c
Created June 4, 2012 20:48
An example of 3[my_array] == my_array[3] in C
#include <stdio.h>
int main(void)
{
int my_array[] = {13, 4, 9, -5, 45};
printf("This is my_array[3]: %d\n", my_array[3]);
printf("This is 3[my_array]: %d\n", 3[my_array]);
return 0;
@fatih
fatih / gist:3105167
Created July 13, 2012 14:23
Sockaddr casting example
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
int main(void)
{
struct sockaddr_in *server;
server->sin_family = AF_INET;
@fatih
fatih / gist:3359902
Created August 15, 2012 12:53
Rastgele TC Kimlik No üreticisi
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Without tk: http://rastgele-tc-kimlik-no-uretici.googlecode.com/svn/trunk/rastgele-tc-kimlik-no-uretici.py
from random import randint
while True:
tcno = randint(10000000000,99999999999)
tc = str(tcno)
listetc = [int(tc[i]) for i in range(11)]
tc10 = 0
@fatih
fatih / incomingConnection
Created November 16, 2012 09:26
void Server::incomingConnection(int socketDescriptor)
void Server::incomingConnection(int socketDescriptor)
{
QSslSocket *socket = new QSslSocket(this);
socket->setProtocol(QSsl::SslV3); // TODO: Or other protocols, like tls, sslv2? Research...
// For now these files should be reside in the same folder as the application
socket->setPrivateKey("server.key"); // $ openssl genrsa -out server.key 2048
socket->setLocalCertificate("server.crt"); // $ openssl req -new -x509 -key server.key -out server.crt -days 1095
if (socket->setSocketDescriptor(socketDescriptor)) {
{nickname} = KD.whoami().profile
path = "/Users/#{nickname}/example.txt"
file = FSHelper.createFileFromPath path
appManager.openFileWithApplication file, 'Ace'
@fatih
fatih / array.go
Created February 8, 2013 08:14
deneme
x := [5]float64{ 98, 93, 77, 82, 83 }
// the notation ... specifies an array length equal to the maximum element index plus one.
a := [...]float64{ 98, 93, 77, 82, 83 }
var total float64 = 0
//for i := 0; i < len(x); i++ {
//total += x[i]
@fatih
fatih / vimrc
Created February 8, 2013 08:17
deneme
set autoindent " Copy indent from current line when starting a new line.
set backspace=indent,eol,start " makes backspace key more powerful.
set showmatch " do not show matching brackets by flickering
set incsearch " shows the match while typing
set hlsearch " highlight found searches
set smartcase " Turn of smart searching
set ignorecase " Search incase sensitive
set ruler "
// Format: "http://user:pass@proxy:port"
"https_proxy": "",
// Enterprise support
"enterprise": false,
// Github URL
// Default: Leave empty if you want to use GitHub.com
// Example: https://github.domain.com
"url": "",
@fatih
fatih / zshrc
Created February 8, 2013 08:29
Deneme
export AMPQ_URL=ampq://localhost/
#rbenv
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
#Disable Autcorrectur
unsetopt correct_all