Skip to content

Instantly share code, notes, and snippets.

@il-katta
il-katta / fedora-fromiso
Created August 6, 2012 16:53
Boot Fedora Live from ISO file using grub2
#!/bin/sh
#
# fedora-fromiso - Patch the ramdisk of Fedora to allow booting from
# ISO image
#
# Copyright (C) 2012 Mansour <mansour@oxplot.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
@il-katta
il-katta / nth-child4IE.js
Created May 28, 2013 00:16
nth-child for IE browser
/* thanks to:
* http://stackoverflow.com/questions/3326494/parsing-css-in-javascript-jquery
* for this parser
*/
function CSS(css){
this.parseCSS=function(css) {
var rules = {};
css = this.removeComments(css);
var blocks = css.split('}');
blocks.pop();
@il-katta
il-katta / stresstest.sh
Last active August 29, 2015 13:57
cpu/mem stresstest
#!/bin/bash
# stresstest.sh
# Author: Andrea Cattaneo < andrea.cattaneo.dev@gmail.com >
# Description: very simple stress test for ram and cpu
# Version: 0.15
mount_point="/mnt/ram"
output_file="$mount_point/stresstest.raw"
run_file="/tmp/stresstest.run"
if ! ( which cpulimit &>/dev/null ) ; then
## Implementazione in bash di cpulimit
RDS_JSON_MOD_VERSION=0.13
DRIZZLE_MOD_VERSION=0.1.7
MODSECURITY_VERSION=2.8.0
SET_MISC_MOD_VERSION=0.26
NGX_DEVEL_KIT_VERSION=0.2.19
FORM_INPUT_VERSION=0.10
NAXSI_VERSION=0.53-2
sudo apt-get -y install dpkg-dev
sudo apt-get build-dep nginx
@il-katta
il-katta / web.runme.sh.conf
Created March 28, 2015 11:18
nginx configuration for php apps
# this configuration is absolutely not safe!!
server {
listen 80;
server_name *.localdomain;
access_log /var/log/nginx/users.access.log;
error_log /var/log/nginx/users.error.log info;
#autoindex on;
#!/bin/bash
# author: Andrea Cattaneo
# check raspberry pi cpu temperature with perfdata and warn/crit thresholds
#
# check raspberry pi temperature with perfdata and warn/crit thresholds.
# The data is read from sysfs ( file: /sys/class/thermal/thermal_zone0/temp ).
#
# Dependency: awk bc
# licence: GPL
if [ -z "$1" ] ; then
[Unit]
Description = Virtualbox VM
After = systemd-user-sessions.service network.target sound.target
ConditionPathExists = /dev/tty0
[Service]
Type = simple
TTYPath = /dev/tty8
StandardInput = tty
StandardOutput = tty
#The following command will set $Disk to all USB drives with >20 GB of storage
#$Disk = Get-Disk | Where-Object {$_.Path -match "USBSTOR" -and $_.Size -gt 20Gb -and -not $_.IsBoot }
$Disk = Get-Disk
#Clear the disk. This will delete any data on the disk. (and will fail if the disk is not yet initialized. If that happens, simply continue with ‘New-Partition…) Validate that this is the correct disk that you want to completely erase.
#
# To skip the confirmation prompt, append –confirm:$False
Clear-Disk –InputObject $Disk[1] -RemoveData
@echo off
rem maybe this software is needed: https://www.microsoft.com/en-us/download/details.aspx?id=48595
rem set WindowsISO=%cd%\%1
set WindowsISO="%cd%\Windows10.iso"
shift
ECHO create partitions
DiskPart /s diskpart_create_single.txt
rem se il file install.wim non è già stato estratto
IF NOT EXIST "%CD%\install.wim" (
rem run with: DiskPart /s diskpart_create_single.txt
rem == diskpart_create_single.txt ==
select disk 1
clean
rem convert mbr
convert gpt
create partition primary
rem active
format quick fs=ntfs label="W2G"
assign letter="W"