Skip to content

Instantly share code, notes, and snippets.

Avatar
🪐

Fatih Arslan fatih

🪐
View GitHub Profile
@fatih
fatih / blog_arsln_org_pointer_arithmetic.c
Created Jun 4, 2012
Examples of pointer arithmetics in C
View blog_arsln_org_pointer_arithmetic.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 Jun 4, 2012
An example of 3[my_array] == my_array[3] in C
View blog_arsln_org_pointer_arithmetic2.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 Jul 13, 2012
Sockaddr casting example
View gist:3105167
#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 Aug 15, 2012
Rastgele TC Kimlik No üreticisi
View gist:3359902
#!/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 Nov 16, 2012
void Server::incomingConnection(int socketDescriptor)
View incomingConnection
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)) {
View gist:4147101
{nickname} = KD.whoami().profile
path = "/Users/#{nickname}/example.txt"
file = FSHelper.createFileFromPath path
appManager.openFileWithApplication file, 'Ace'
View array.go
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]
View vimrc
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 "
View Gist.sublime-settings
// 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": "",
View zshrc
export AMPQ_URL=ampq://localhost/
#rbenv
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
#Disable Autcorrectur
unsetopt correct_all