Skip to content

Instantly share code, notes, and snippets.

View biapar's full-sized avatar
🙂

Biagio Paruolo biapar

🙂
View GitHub Profile
@biapar
biapar / deleting_tons_of_files_in_linux.md
Created March 1, 2018 10:57 — forked from bitkidd/deleting_tons_of_files_in_linux.md
Deleting tons of files in Linux (Argument list too long)

If you’re trying to delete a very large number of files at one time (I deleted a directory with 485,000+ today), you will probably run into this error:

/bin/rm: Argument list too long.

The problem is that when you type something like “rm -rf ”, the “” is replaced with a list of every matching file, like “rm -rf file1 file2 file3 file4” and so on. There is a reletively small buffer of memory allocated to storing this list of arguments and if it is filled up, the shell will not execute the program. To get around this problem, a lot of people will use the find command to find every file and pass them one-by-one to the “rm” command like this:

find . -type f -exec rm -v {} \;

My problem is that I needed to delete 500,000 files and it was taking way too long.

@biapar
biapar / README.md
Created December 18, 2017 07:46 — forked from magnetikonline/README.md
Reset Windows 2012R2 local administrator password.

Reset Windows 2012R2 local administrator password

  • Boot from Microsoft Windows Server 2012R2 DVD/ISO.
  • From the Windows Setup menu, click "Next".
  • Select "Repair your computer".
  • Click on "Troubleshoot".
  • Under Advanced options, click "Command Prompt".

At the command prompt, run the following commands:

@biapar
biapar / export-html-table-to-excel.md
Created November 23, 2017 10:09 — forked from umidjons/export-html-table-to-excel.md
Export HTML table to Excel in AngularJS

Export HTML table to Excel in AngularJS

myApp.factory('Excel',function($window){
		var uri='data:application/vnd.ms-excel;base64,',
			template='<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>',
			base64=function(s){return $window.btoa(unescape(encodeURIComponent(s)));},
			format=function(s,c){return s.replace(/{(\w+)}/g,function(m,p){return c[p];})};
		return {
@biapar
biapar / ImportController.cs
Created October 22, 2017 19:07 — forked from DavidVeksler/ImportController.cs
How FEE digitized and shared 70 years of archives on the Web: an Umbraco case study
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using Archive.FEE.Web.Helper.PDFParser;
using Umbraco.Core;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
@biapar
biapar / gist:7bc193df444814bf759d25aa8aee4125
Created May 11, 2017 21:59 — forked from detroitpro/gist:df88e20e508118269ee2
Xamarin Forms Parallax Scrolling
public class DemoPage : ContentPage
{
public DemoPage ()
{
var image = new Image () {
Source = "http://eric.polerecky.com/images/abstract-1.jpg",
VerticalOptions = LayoutOptions.Start,
Scale = 3,
AnchorY = 0
};
@biapar
biapar / documentlist.cshtml
Created April 11, 2017 10:34 — forked from KevinJump/documentlist.cshtml
Umbraco Macro file to render a list of documents on a page
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@using Umbraco.Web.Models
@{
var folders = Model.GetParameterValue<string>("mediaFolder", "")
.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
var subFolders = Model.GetParameterValue<bool>("subFolders", true);
var selection = Umbraco.TypedMedia(folders).Where(x => x != null);
@biapar
biapar / umbraco-filebrowser.cshtml
Created April 11, 2017 10:31 — forked from alirobe/umbraco-filebrowser.cshtml
A simple recursive media folder/file viewer macro for directory browsing in #Umbraco 7+, using Bootstrap 3 for display. Not suitable for >100 files (use a surfacecontroller)
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@{ var mediaId = Model.MacroParameters["mediaId"]; }
@helper DisplayFolder(dynamic folder, bool collapsed) {
var items = folder.Children().OrderBy("DocumentTypeAlias Desc,Name");
if (items.Any()) {
<a class="list-group-item" role="button" aria-expanded="false" data-toggle="collapse" href="#[email protected]">
<i class="glyphicon glyphicon-folder-open"></i> &nbsp; @folder.Name
</a>
<div class="list-group @(collapsed?"collapse":"collapse in") well well-sm" id="[email protected]">
@foreach(var item in items) {
@biapar
biapar / ForgotPassword.cshtml
Last active January 24, 2017 15:33 — forked from DavidVeksler/ForgotPassword.cshtml
Umbraco 7: reset password for user and forgot password implementation
@using FEE.Domain
@inherits UmbracoTemplatePage
@{
Layout = "FEEMaster.cshtml";
var featuredImage = CoverImageProvider.GetCoverImageOrDefault(CurrentPage.featuredImage);
}
@section bodyClass {subpage}
@*TODO maybe implement:https://github.com/warrenbuckley/CWS-Umbraco-Standard-Membership/blob/master/CWSUmbracoStandardMembership/Views/AuthSurface/ResetPassword.cshtml
@biapar
biapar / gist:2902f4ee8790af18dcd875a0040d8a32
Created December 14, 2016 13:46
An Umbraco partial view that list the last six post from Articulate blog
@inherits Umbraco.Web.Mvc.UmbracoViewPage<IPublishedContent>
@using Articulate;
@using Articulate.Models;
@using Umbraco;
@using Umbraco.Web;
@using Umbraco.Core;
@using Umbraco.Core.Models;
@using System.Linq;
@using System;
@{
@biapar
biapar / gist:2c92a7b559bc5890ba606acfa6e10004
Created November 5, 2016 14:06
Zurb Foundation 6 and Jarallax: CSS Tip
.jarallax {
position: relative;
background-size: cover;
background-repeat: no-repeat;
left: 50%;
top: 50%;
min-width: 100%;
min-height: 100%;
-webkit-transform: translate(-50%,-50%);
-moz-transform: translate(-50%,-50%);