Skip to content

Instantly share code, notes, and snippets.

View fatih's full-sized avatar

Fatih Arslan fatih

View GitHub Profile
@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 / 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'
// 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 / 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 "
@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 / 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
@fatih
fatih / Default (OSX).sublime-keymap
Created February 19, 2013 07:46
Vintage key bindings
[
{ "keys": ["ctrl+shift+r"], "command": "expand_selection_to_paragraph" },
{ "keys": ["ctrl+u"], "command": "scroll_lines", "args": {"amount": 30.0}, "context": [{ "key": "setting.command_mode" }]},
{ "keys": ["ctrl+d"], "command": "scroll_lines", "args": {"amount": -30.0}, "context": [{"key": "setting.command_mode"}]},
{ "keys": ["j", "k"], "command": "exit_insert_mode",
"context":
[
{ "key": "setting.command_mode", "operand": false },
{ "key": "setting.is_widget", "operand": false }
]
@fatih
fatih / Preferences.sublime-settings
Created February 19, 2013 07:47
Sublime settings
{
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"find_selected_text": true,
"folder_exclude_patterns":
[
".svn",
".git",
".hg",
"CVS",
".build"
@fatih
fatih / zmq_client.go
Created May 16, 2013 23:18
Start in order go run zmq_device.go go run zmq_server.go go run zmq_client.go
package main
import (
"fmt"
zmq "github.com/alecthomas/gozmq"
)
func main() {
context, _ := zmq.NewContext()
socket, _ := context.NewSocket(zmq.REQ)