Change OldExtension and NewExtension :
find . -type f -name *.mqh -exec sh -c 'mv "$1" "${1%.OldExtension}.NewExtension"' _ {} \;
| using System.Collections.Generic; | |
| using System.Linq; | |
| // https://www.nuget.org/packages/TestStack.White | |
| using TestStack.White; | |
| using TestStack.White.UIItems; | |
| using TestStack.White.UIItems.Finders; | |
| namespace MTBacktester | |
| { |
| # Restore a complete copy of the SSD (sda device) | |
| gunzip -c /media/data/IMAGE_NAME.img.tgz | dd of=/dev/sda | |
| # Create and compress complete backup of sda (the SSD) disk | |
| dd if=/dev/sda conv=sync,noerror bs=1k | gzip -c > "ssd_sda_`date '+%Y%m%d'`.img.gz" | |
| # Remove LVM the snapshot | |
| sudo lvremove /dev/ubuntuvg/rootsnap | |
| # Create LVM snapshot |
| protected async Task UploadPost(Post post, string endpoint) | |
| { | |
| var client = new HttpClient(); | |
| var json = JsonConvert.SerializeObject(post, Formatting.Indented); | |
| var content = new StringContent(json, Encoding.UTF8, "application/json"); | |
| var url = $"{endpoint}"; | |
| var response = await client.PostAsync(url, content); | |
| if (!response.IsSuccessStatusCode) | |
| { | |
| throw new Exception($"Could not upload post {post.DetailsUri}: {response.ReasonPhrase}"); |
| public class Pager | |
| { | |
| public Pager(int totalItems, int? page, int pageSize = 10) | |
| { | |
| // calculate total, start and end pages | |
| var totalPages = (int)Math.Ceiling((decimal)totalItems / (decimal)pageSize); | |
| var currentPage = page != null ? (int)page : 1; | |
| var startPage = currentPage - 5; | |
| var endPage = currentPage + 4; | |
| if (startPage <= 0) |
| protected string GetRenderedPartial(string viewName, object model = null) | |
| { | |
| using (var sw = new StringWriter()) | |
| { | |
| if (ControllerContext != null) | |
| { | |
| var viewResult = ViewEngines.Engines.FindPartialView(ControllerContext, viewName); | |
| var viewContext = new ViewContext(ControllerContext, viewResult.View, new ViewDataDictionary(model), TempData, sw); | |
| viewResult.View.Render(viewContext, sw); | |
| } |
| #!/bin/bash | |
| echo "Getting $2 levels of $1" | |
| if [ "$2" = "" ]; then | |
| wget -k -p -nc -r -l 1 $1 | |
| exit | |
| fi | |
| wget -k -p -nc -r -l $2 $1 |