Skip to content

Instantly share code, notes, and snippets.

@mcihad
mcihad / main.go
Created September 4, 2018 19:35
Check standart django password in go language
package main
import (
"crypto/sha256"
"encoding/base64"
"fmt"
"golang.org/x/crypto/pbkdf2"
"strconv"
"strings"
)
@mcihad
mcihad / createdb
Created September 2, 2018 13:11
Postgresql Database Collate
create database <dbname> with LC_COLLATE='tr_TR.UTF-8' LC_CTYPE='tr_TR.UTF-8' template=template0 owner='<owner>'
@mcihad
mcihad / strjoin.py
Created August 29, 2018 19:04
Python String Birleştirme
def f1(n):
import time
start=time.time()
a = ["Hi there "]
for i in range(n):
a.append(f"({i},{i}),")
s="".join(a)
end=time.time()
print(f"{n} adet deneme -> {end-start}")
return s
@mcihad
mcihad / strjoin.go
Created August 29, 2018 19:03
Go String Birleştirme Testi
package main
import (
"bytes"
"fmt"
"strconv"
"strings"
"time"
)
@mcihad
mcihad / app.py
Created September 17, 2017 19:28
N11 CityService Kullanımı
from flask import Flask, render_template
from suds.client import Client
app = Flask(__name__)
class CityService(object):
__cities = []
__loaded = False
__wsdl = "https://api.n11.com/ws/CityService.wsdl"
@mcihad
mcihad / urlparam.xhtml
Created May 8, 2017 10:55
How to get url parameter
<f:metadata>
<f:viewParam name="CustomerID" value="#{customerBean.customerId}" />
<f:event listener="#{customerBean.loadData()}" type="preRenderView" />
</f:metadata>
@mcihad
mcihad / ThymeleafConfig.java
Created May 7, 2017 15:35
Thymeleaf Annotation Config
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import org.springframework.core.env.Environment;
import org.thymeleaf.spring4.SpringTemplateEngine;
import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver;
import org.thymeleaf.spring4.view.ThymeleafViewResolver;
@mcihad
mcihad / thymeleafContext.xml
Created May 3, 2017 10:41
thymeleaf spring xml config
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<context:property-placeholder location="classpath:application.properties" />
<mvc:annotation-driven/>
<!--
<mvc:resources mapping="/resources/**" location="/resources/" />
@mcihad
mcihad / databaseConfig.xml
Created May 3, 2017 10:40
Spring hibernate xml config
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<context:property-placeholder location="classpath:application.properties" />
<!--
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
@mcihad
mcihad / faces-config.xml
Created May 2, 2017 07:07
Faces Config spring
<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd"
version="2.1">
<application>
<el-resolver>
org.springframework.web.jsf.el.SpringBeanFacesELResolver