This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
public class Program | |
{ | |
public static void Main() | |
{ | |
List<string> listed = new List<string>() {"1", "2", "3", "4"}; | |
Console.WriteLine(">" + string.Join("-", listed)); | |
// >1-2-3-4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public class Program | |
{ | |
public static void Main() | |
{ | |
// simple string interpolation | |
string someString = @" | |
Do you have a {0} {1} ? | |
"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace SomeNamespace | |
{ | |
using System; | |
class CustomException : Exception | |
{ | |
public CustomException() | |
: base() { } | |
public CustomException(string message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_logger(): | |
""" | |
Returns a logger object that can directly be used. | |
It is a single function singleton, | |
it returns the same object each time it is called. | |
Do not forget to change: | |
logger_name = "defaultlogger" | |
logger_file_path = "log1.log" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`echo $SHELL` --version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uname -a | |
cat /etc/redhat-release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf8 -*- | |
# http://www.python.org/dev/peps/pep-0263/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
OlderNewer