Skip to content

Instantly share code, notes, and snippets.

Batuhan Bayrakci baybatu

View GitHub Profile
@baybatu
baybatu / gist:2884901
Created Jun 6, 2012
Windows Konsolda Türkçe Karakterlerin Gösterilmesi
View gist:2884901
Bunun için iki adım gereklidir.
1. Konsolun yazı tipini TrueType bir yazı tipine çevirmek gerekir. Lucida Console ya da Consolas olabilir.
2. chcp 1254 komutu ile kod sayfasını değiştirmek
@baybatu
baybatu / dosya_zaman.py
Created Jun 25, 2012
Python'da dosyanın son değiştirme zamanını almak
View dosya_zaman.py
import os
(mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime) = os.stat("dosya.py")
# bu çok tercih edilmez. bir de daha karışık
####### ya da #########
a = os.path.getmtime("foo.py")
print type(a) # float
# 1340619312.918 gibi bir float sayı verir. Bunu okunabilir hale getirmek için time modülündeki ctime metodu kullanılabilir.
@baybatu
baybatu / tomcat_killer.sh
Last active Dec 15, 2015
Kill tomcat from terminal easily
View tomcat_killer.sh
#!/bin/bash
ps -A | grep tomcat | awk '$4 !~ /grep/ {print $1}' | xargs kill -9
@baybatu
baybatu / logback-logger-off.md
Created Nov 8, 2015
Stopping Logging For All Levels In Logback
View logback-logger-off.md

When you need to tell Logback to stop logging for a logger, the following snippet can be added to logback.xml configuration file:

<logger name="loggerName">
    <level value="off" />
</logger>

"loggerName" represents your logger name that will be stopped.

@baybatu
baybatu / pkg_resources-DistributionNotFound-six.md
Created Nov 8, 2015
A Solution For 'pkg_resources.DistributionNotFound six' Problem
View pkg_resources-DistributionNotFound-six.md

Today i have decided to write some unit test on JavaScript via Jasmine, but i encountered the following exception stack trace.

Traceback (most recent call last):
  File "/usr/local/bin/jasmine", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module>
    working_set.require(__requires__)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
@baybatu
baybatu / maven-war-exclude-directory.md
Last active May 7, 2018
Excluding Directory From War Package In maven-war-plugin
View maven-war-exclude-directory.md

packagingExcludes configuration tag can be used to exclude certain files or directories from the war file. It is important to put '/' character at the end of the directory to be excluded. If there is no such '/' character, then the entry is interpreted as a regular file.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.3</version>
    <configuration>
@baybatu
baybatu / primefaces-dataexport-column-display-none.md
Last active Nov 9, 2015
Hiding Exported Column On DataTable In PrimeFaces
View primefaces-dataexport-column-display-none.md

The talented DataExporter component of the PrimeFaces can be used to export data listed in DataTable to various file formats, such as xls, pdf, csv and xml. Also, exportable attribute of column component inside of DataTable, can be used to determine to whether the column is exported to file or not. Well, what if we want to export a column without displaying on DataTable? In this case, we can add:

display: none;
@baybatu
baybatu / get-domain-mapping-in-grails.groovy
Last active Nov 14, 2015
Getting mapping from domain class in Grails
View get-domain-mapping-in-grails.groovy
class Person {
Long id
String name
static mapping = {
table name: 'PERSON'
id column: 'PRS_ID'
name column: 'PRS_NAME'
}
}
@baybatu
baybatu / attach-listener-to-push-method.js
Last active Mar 17, 2019
Attach event listener to Array push method call
View attach-listener-to-push-method.js
var eventify = function(arr, callback) {
arr.push = function(e) {
Array.prototype.push.call(arr, e);
callback(arr);
};
};
var array = [1,2,3];
eventify(array, function(newArray) {
@baybatu
baybatu / logging-urlmappings-in-grails.md
Last active Jan 10, 2016
Logging UrlMapping file mapping in Grails
View logging-urlmappings-in-grails.md

Add following log configuration into log4j block in Config.groovy.

all 'org.codehaus.groovy.grails.web.mapping'
You can’t perform that action at this time.