- https://github.com/enochtangg/quick-SQL-cheatsheet - A quick reminder of all relevant SQL queries and examples on how to use them.
- https://dbdiagram.io/ - A free and simple tool to draw ER diagrams by just writing code.
| <# | |
| Rename-Files.ps1 | |
| #> | |
| # Find all wmv-files with a string "oldstring" and replace "oldstring" with "newstring" in the filename | |
| Get-ChildItem *.wmv -Filter "*oldstring*" | ForEach { Rename-Item $_ -NewName $_.Name.Replace("oldstring","newstring") } | |
| # Change the file extension of all .jpeg files to .jpg |
| SELECT STRAIGHT_JOIN categories.id, categories.title, categories.game_count, categories.display_order FROM `categories` INNER JOIN `category_namespaces` ON `category_namespaces`.`category_id` = `categories`.`id` WHERE `categories`.`type` IN ('ClickJogos::GameCategory') AND `categories`.`published` = 1 AND (category_namespaces.namespace = 'jgo') ORDER BY | |
| CASE | |
| WHEN categories.id LIKE '447%' THEN 1 | |
| WHEN categories.id LIKE '448%' THEN 2 | |
| ELSE 3 | |
| END, categories.game_count DESC; |
| import numpy | |
| import pandas | |
| numpy.random.seed(0) | |
| index1 = pandas.MultiIndex.from_product( | |
| [['A'], ['b'], ['one', 'two']], | |
| names=['City', 'Street', 'House'] | |
| ) | |
| index2 = pandas.MultiIndex.from_product( |
| import glob | |
| import sys | |
| import pandas | |
| def read_filenames(names): | |
| for arg in names: | |
| if "*" in arg: | |
| for file in glob.glob(arg): | |
| yield file |
Looking for something else? Take a look at the awesome collection of other awesome lists.
| -- Umbraco Clear Old Document Versions To Decrease Database Size And Improve Performance | |
| -- http://borism.net/2008/12/16/fixing-a-large-cmspropertydata-table-in-umbraco/ | |
| DECLARE @createdDate Datetime = DATEADD(m, -1, getdate()) | |
| -- dump logs | |
| -- TRUNCATE TABLE umbracolog -- faster if log table is very big and you don't need anything | |
| DELETE FROM umbracolog WHERE Datestamp < @createdDate | |
| -- clean up old versions | |
| DELETE FROM cmsPropertyData WHERE |
| public class FormsValidation : ApplicationEventHandler | |
| { | |
| protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) | |
| { | |
| Umbraco.Forms.Web.Controllers.UmbracoFormsController.FormValidate += UmbracoFormsController_FormValidate; | |
| } | |
| void UmbracoFormsController_FormValidate(object sender, Umbraco.Forms.Mvc.FormValidationEventArgs e) | |
| { |
| var stopwatch = Stopwatch.StartNew(); | |
| for (int i = 1; i < 1000000000; i++) | |
| { | |
| // run method here | |
| } | |
| stopwatch.Stop(); | |
| Console.writeline("Elapsed time: {0}", stopwatch.Elapsed); |