Skip to content

Instantly share code, notes, and snippets.

View caglartoklu's full-sized avatar

Çağlar Toklu caglartoklu

View GitHub Profile
@caglartoklu
caglartoklu / rhel_version.sh
Created February 7, 2013 09:40
Find out Red Hat Linux version #redhat #linux #shell
uname -a
cat /etc/redhat-release
@caglartoklu
caglartoklu / where_is_site_packages.sh
Last active December 12, 2015 06:29
Displays the location of the directory "site-packages" of Python.Run it from shell(bash or cmd.exe), not from the Python interpreter itself. #python #shell #path
python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"
@caglartoklu
caglartoklu / encoding.py
Last active December 12, 2015 06:29
Python source encoding.Add the code to the top of your source file. #python #encoding
# -*- coding: utf8 -*-
# http://www.python.org/dev/peps/pep-0263/
@caglartoklu
caglartoklu / shell_version.sh
Created February 7, 2013 09:48
shell version #shell
`echo $SHELL` --version
@caglartoklu
caglartoklu / is_ironpython.py
Created February 7, 2013 09:49
If the platform is IronPython, this function returns True, False otherwise. #python #ironpython
import sys
def is_ironpython():
"""
If the platform is IronPython, this function returns True, False otherwise.
"""
result = False
if sys.platform == "cli":
result = True
return result
@caglartoklu
caglartoklu / module_path.py
Last active December 12, 2015 06:29
Displays the current module name and its path. #python #path
# http://docs.python.org/reference/datamodel.html?highlight=__file__
# Current module name
print __file__
# module1.py
# Path of the current module
import os
print os.path.abspath(os.path.dirname(__file__))
# /home/myusername/projects/project1
@caglartoklu
caglartoklu / install_dosbox.sh
Last active February 15, 2024 21:26
Installing and Configuring DOSBox on Ubuntu #dosbox #ubuntu
# DOSBox is a great emulator to run old DOS games
# and applications.
# This configuration has been tested on Ubuntu 11.04 with DOSBox 0.74
# but# it should work on other distros too.
# This code snippet runs on a fresh install of DOSBox
# since it appends lines to DOSBox configuration file.
@caglartoklu
caglartoklu / app.config
Last active December 13, 2015 18:19
Simple app.config usage in C#. #cs #config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<appSettings>
<add key="one" value="1"/>
<add key="two" value="2"/>
<add key="three" value="3"/>
<add key="four" value="4"/>
@caglartoklu
caglartoklu / simplehttpserver.sh
Created February 17, 2013 10:54
Simple HTTP Server in Python >= 2.4. #python #http #server
python -m SimpleHTTPServer 8090
@caglartoklu
caglartoklu / .bash_profile
Created February 18, 2013 10:25
.bash_profile configuration for Python 2.6, cx_Oracle 5.1.2, Oracle Client 11.2.0 on RHEL 6.3 #bash #oracle #shell
# save this file as .bash_profile, or merge with the existing one.
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
# Red Hat Enterprise Linux Server release 6.3, x84_64
# Oracle Client 11.2.0 (not Instant Client)
# Python 2.6