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 to_str(text): | |
''' | |
convert unicode to string | |
''' | |
try: | |
return str(text) | |
except: | |
return str(text.encode("utf-8")) | |
def to_unicode(text): |
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
/** | |
* Provide extended math utilities. | |
* | |
* Author: Ronen Ness. | |
* Since: 2017. | |
*/ | |
"use strict"; | |
/** | |
* Provide extended math utilities. |
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
# Dump this at the end of your setting file. | |
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': False, | |
'formatters': { | |
'verbose': { | |
'format': "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s", | |
'datefmt': "%d/%b/%Y %H:%M:%S" | |
}, |
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 threading | |
import socket | |
# listening to socket with random port | |
sd = socket.socket(socket.AF_INET) | |
sd.bind(('127.0.0.1', 0)) | |
ip, port = sd.getsockname() | |
sd.listen(5) | |
# connect to socket from "client" side |
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
/// <summary> | |
/// Add extended math utils. | |
/// </summary> | |
public static class MathHelper | |
{ | |
/// <summary> | |
/// PI x 2 value. | |
/// </summary> | |
public static readonly float PI2 = (float)Math.PI * 2; |
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 | |
import os | |
# print usage | |
if len(sys.argv) < 2: | |
print ("Usage: split_logs.py filename [lines_per_file]") | |
exit(1) | |
# get filename | |
filename = sys.argv[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
""" | |
Run this script from a folder with image files to resize them all to a desired width. | |
Set 'DESIRED_WIDTH' to choose output images width (height will be calculated automatically to preserve ratio). | |
Set 'ROTATION' to optionally rotate image before resizing. | |
Set 'EXTENSIONS' to change what type of files to process. | |
Note: requires PIL package. | |
""" | |
import os | |
from PIL import Image | |
import shutil |
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
/// <summary> | |
/// Save / load XML files. | |
/// </summary> | |
public static class XmlFiles | |
{ | |
/// <summary> | |
/// Show last XML file read. For debug purposes. | |
/// </summary> | |
public static string LastReadFile { get; private set; } |
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
""" | |
INSTRUCTIONS: | |
Replace command = '''...''' with the desired pixelator command you want to run recursively. | |
To get the command you want, you can click on View --> Shell Command from Pixelator GUI. | |
WARNING: | |
This will replace the original files! If you want to create a copy, change the following line: | |
full_command = command.replace('__in_file__', fullpath).replace('__out_file__', fullpath) | |
To something like: |
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 Microsoft.CodeAnalysis; | |
using Microsoft.CodeAnalysis.CSharp; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.IO; | |
using System.Reflection; | |
using Microsoft.CodeAnalysis.Emit; | |
namespace CSharpDynamicCompileExample |
OlderNewer