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 datetime | |
# Create a program that asks the user to enter their name and their age. Print out a message addressed to them that tells them the year that they will turn 100 years old. | |
one_hundred_years = datetime.date.today().year - int(input("Enter your age:\n")) + 100 | |
print_count = input("How many times do you want to print it?\n") | |
for i in range(int(print_count)): | |
print("%s You will hit 100 years on %s"%(i+1,one_hundred_years)) |
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
entered_number = int(input("Enter the number and i will tell you is it EVEN or ODD\n")) | |
if entered_number % 2 == 0: | |
if entered_number % 4 == 0: | |
print("Its EVEN, but also /4!") | |
else : | |
print("You've entered EVEN number!") | |
else: | |
print("You've entered ODD number!") |
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
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] | |
print("Printing numbers less then 5 \n") | |
print([t for t in a if t < 5]) |
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; | |
using System.Linq; | |
using System.Text; | |
public static class GeoEngTranslit | |
{ | |
static readonly Dictionary<char, string> EngGeoDictionary = new Dictionary<char, string>() | |
{ | |
{'a',"ა"}, |
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
public string run_cmd(string cmd, string args) | |
{ | |
ProcessStartInfo start = new ProcessStartInfo(); | |
start.FileName = "PATH_TO_PYTHON_EXE"; | |
start.Arguments = string.Format("\"{0}\" \"{1}\"", cmd, args); | |
start.UseShellExecute = false;// Do not use OS shell | |
start.CreateNoWindow = true; // We don't need new window | |
start.RedirectStandardOutput = true;// Any output, generated by application will be redirected back | |
start.RedirectStandardError = true; // Any error in standard output will be redirected back (for example exceptions) | |
using (Process process = Process.Start(start)) |
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
public string PatchParameter(string parameter, int serviceid) | |
{ | |
var engine = Python.CreateEngine(); // Extract Python language engine from their grasp | |
var scope = engine.CreateScope(); // Introduce Python namespace (scope) | |
var d = new Dictionary<string, object> | |
{ | |
{ "serviceid", serviceid}, | |
{ "parameter", parameter} | |
}; // Add some sample parameters. Notice that there is no need in specifically setting the object type, interpreter will do that part for us in the script properly with high probability |
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 Polly; | |
namespace ConsoleApp1 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
// Retry a specified number of times, using a function to |
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
string t = Regex.Replace("\u2649\u0009010\u200F260\\15200F609", @"[\u0009\u200F\u200E\u000D]", ""); | |
Console.WriteLine(t); // \u0009 - TAB, \u200F - RTL, \u200E - LTR, \u000D - new line (carriage return char (cr)) and this will leave only: ?10260\15200F609 |
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
#!/usr/bin/python | |
""" | |
Run the script like: $ pytest -s test_stdout_stderr.py | |
-s shortcut for --capture=no | |
""" | |
import sys | |
def test_hello(): | |
print("hello testing") |
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
[loggers] | |
keys=root, gunicorn.error, gunicorn.access, requests.packages.urllib3.connectionpool, __main__ | |
[handlers] | |
keys=log_file, syslog | |
[formatters] | |
keys=generic | |
[logger_root] |
OlderNewer