Skip to content

Instantly share code, notes, and snippets.

View biapar's full-sized avatar
🙂

Biagio Paruolo biapar

🙂
View GitHub Profile
anonymous
anonymous / Login-and-Sidemenu-with-IONIC-Framework.markdown
Created May 10, 2014 12:43
A Pen by Biagio Paruolo.
@biapar
biapar / InitArcheType
Last active October 18, 2015 11:03
How to read and write to Umbraco Archetype
var archetypeValueAsString = member.GetValue<string>("figli");
var member = Services.MemberService.GetById(user.Id);
if (archetypeValueAsString == null)
{
//var archetype2 = JsonConvert.DeserializeObject<ArchetypeModel>(archetypeValueAsString);
ArchetypeModel a = new ArchetypeModel();
@biapar
biapar / gist:18a9c4d77702743dbca4
Created December 17, 2015 14:16 — forked from grandmanitou/gist:8863248
Place multiple markers with infowindow on Google Maps API v3, use external links to trigger click and center map on desired location.
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?language=fra&amp;sensor=false"></script>
<script type="text/javascript">
var map;
var Markers = {};
var infowindow;
var locations = [
[
'Samsung Store Madeleine',
'<strong>Samsung Store Madeleine</strong><p>5 Boulevard Malesherbes, 75008 Paris<br>10h – 20h</p>',
48.8701925,
@splacento-incomm
splacento-incomm / hacked wordpress scan
Created January 22, 2015 05:40
Hacked wordpress can /usr/bin/host
/usr/bin/host has been preloaded;
grep -ri --include=*.php "/usr/bin/host" ./
check all cronjobs:
for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l; done
check running processes:
ps -aux
@biapar
biapar / uninstall_vmware.sh
Created September 3, 2016 14:42 — forked from boneskull/uninstall_vmware.sh
completely uninstall vmware on mac
#!/usr/bin/env bash
# Usage: bash uninstall_vmware.bash
remove() {
entry="$1"
echo -ne "Removing \e[1;34m$entry\e[0m... "
sudo rm -rf "$entry" &> /tmp/uninstall-vmware.log
if [[ ! -e "$entry" ]]; then
echo -e "\e[1;32mOK\e[0m"
@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 / 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="#macro-mediaList-folder-@folder.Id">
<i class="glyphicon glyphicon-folder-open"></i> &nbsp; @folder.Name
</a>
<div class="list-group @(collapsed?"collapse":"collapse in") well well-sm" id="macro-mediaList-folder-@folder.Id">
@foreach(var item in items) {
@DavidVeksler
DavidVeksler / ImportController.cs
Created August 22, 2016 22:12
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;
@nul800sebastiaan
nul800sebastiaan / TicketOrderController.cs
Created February 9, 2015 16:09
TicketOrderController.cs
using System;
using System.Linq;
using System.Web.Mvc;
using Umbraco.Course.Models;
using Umbraco.Web.Mvc;
namespace Awesome.FormDemo.Controllers
{
public class TicketOrderController : SurfaceController
{
@bitkidd
bitkidd / deleting_tons_of_files_in_linux.md
Last active August 14, 2018 13:59
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.