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
static string FormatFileSize(long value, string format = null) | |
{ | |
var multipliers = new string[] { "o", "Kio", "Mio" }; | |
var midx = 0; | |
while ((Math.Abs(value) >= 1024) && (midx < multipliers.Length)) | |
{ | |
value /= 1000; | |
++midx; | |
} |
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> | |
/// Changes the file extension by moving it. | |
/// </summary> | |
/// <param name="filePath">Full path to the file for which change the extension.</param> | |
/// <param name="extension">The new file extension.</param> | |
/// <returns>The path to the file, with the new extension.</returns> | |
private string ChangeFileExtension(string filePath, string extension) | |
{ | |
if (!extension.StartsWith(".")) | |
extension = "." + extension; |
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; | |
namespace Untunh.Helpers | |
{ | |
/// <summary> | |
/// Provides a set of static methods for querying objects that implement System.Collections.Generic.IEnumerable<T>. | |
/// </summary> | |
public static class Extensions |
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.ComponentModel; | |
using System.Linq; | |
namespace Untunh.Helpers | |
{ | |
/// <summary> | |
/// Provides a set of static methods for querying objects that represent an enumeration. | |
/// </summary> |
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; | |
class Benchmarker | |
{ | |
const int NB_RUN = 5; | |
public static void Benchmark(Action testMethod, string testName = null, bool blankRun = false) | |
{ | |
if (string.IsNullOrEmpty(testName)) | |
testName = testMethod.Method.Name; |
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
# this requires NuGet to be installed, so it will bring the PowerShell command line | |
# and the EnvDTE object. See: https://msdn.microsoft.com/en-us/library/EnvDTE.aspx | |
function DoItOnProjectItem($item) { | |
$doc = $item; | |
if ($doc.Name -match "\.cs$") { | |
write-host $doc.Name; | |
# open and display document | |
$foo = $doc.Open("{7651A701-06E5-11D1-8EBD-00A0C90F26EA}"); # vsViewKindCode -> to display code window |
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
<pre> | |
(function(length, prefix, suffix, map) { | |
/* Version 1.0 */ | |
var p = location.hostname.split('.'); | |
// Find service name | |
do { var pass = p.pop(); } | |
while (p.length && pass.length <= 3); | |
// First time assume domain | |
if (!this._custom_) { | |
this._custom_ = true; |
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
from queue_db import QueuedWriter | |
from pymongo import Connection | |
from flask import Flask | |
from json import dumps | |
def main(): | |
'''This is just an example using Flask and MongoDB/pymongo. | |
Of course, you can use any web server and any database as long as you set up the methods appropriately''' |
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
-- réduire les LOGS | |
BACKUP LOG [Concours] TO DISK = N'E:\Backup\Concours-logs.bak' | |
USE [Concours] | |
ALTER DATABASE [Concours] SET RECOVERY SIMPLE WITH NO_WAIT | |
DBCC SHRINKFILE(Concours_Log, 1) | |
ALTER DATABASE [Concours] SET RECOVERY FULL WITH NO_WAIT | |
-- réduire le fichier de DATA |
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/env node | |
/** | |
* After prepare, files are copied to the platforms/[platform] folder. | |
* Lets clean up some of those files that arent needed with this hook. | |
*/ | |
var fs = require('fs'); | |
var path = require('path'); | |
var rootdir = process.argv[2]; |
OlderNewer