Skip to content

Instantly share code, notes, and snippets.

View phosphore's full-sized avatar
🎯
Focusing

Lorenzo Stella phosphore

🎯
Focusing
View GitHub Profile
/*
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <dirent.h>
#include <math.h>
#include <fcntl.h>
#include <assert.h>
#include <malloc.h>
#include <sys/mman.h>
@phosphore
phosphore / WeLoveNoise.js
Last active August 29, 2015 14:02
Formatted source of obfuscated js @ http://www.welovenoise.com/assets/js/main.js (require.js)
This file has been truncated, but you can view the full file.
// Source -> http://www.welovenoise.com/assets/js/main.js
var requirejs, require, define;
(function (global) {
function isFunction(t) {
return "[object Function]" === ostring.call(t)
}
function isArray(t) {
return "[object Array]" === ostring.call(t)
}
@phosphore
phosphore / gmailcheck.sh
Created August 3, 2014 15:16
A simple bash script that uses google's tts service to notify new emails. [IT-it]
#!/bin/bash
rm /home/pi/bash/tmp/atom
wget --no-check-certificate -q -P/home/pi/bash/tmp/ https://user:[email protected]/mail/feed/atom
email=$((`perl -ne 'while(/author/g){++$count}; print "$count\n"' /home/pi/bash/tmp/atom`/2))
sender=`grep -oPm1 "(?<=<name>)[^<]+" /home/pi/bash/tmp/atom | tr '\n' ','`
echo $sender
if [ "$email" == 1 ]; then
email=$email
mpg123 -q attention.mp3
/bin/bash ./speech2text.sh "C'è una nuova mail da $sender ."
@phosphore
phosphore / keybase.md
Last active August 29, 2015 14:07
keybase.md

Keybase proof

I hereby claim:

  • I am phosphore on github.
  • I am phosphore (https://keybase.io/phosphore) on keybase.
  • I have a public key whose fingerprint is 3843 2C3C 0FC1 BF56 0524 B899 76CD D69E 3167 D4CA

To claim this, I am signing this object:

<?php
include 'lib/WideImage.php';
/* Carico le risorse */
$imagesopra = WideImage::load("a.png"); /* LAYER SOPRA immagine iniziale caricata con WideImage */
$image = WideImage::load("a.png"); /* caricata con WideImage, andremo a modificare questa */
/* Trovo x e y */
$sizex = $image->getWidth();
$sizey = $image->getHeight();
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
if ! pkill -kill wicd*; then echo "Couldn't kill wicd (maybe it's not even running?)"; exit 1; fi
if ! service wicd stop; then echo "Couldn't stop wicd daemon"; exit 1; fi
if ! service NetworkManager start; then echo "Couldn't start Network Manager"; exit 1; fi
echo "All done :)"
preg_match("/^\/per-(.*?)(-a-(.*))?\.html/", $this->uri, $matches); // vediamo se l'uri è /per-qualcosa.html o /per-qualcosa-a-luogo.html
if (count($matches) === 0) { // è solo una città
preg_match("/^\/(.+)\.html/", $this->uri, $cityArray);
$city = $cityArray[1];
echo $city;
} else if (count($matches) === 2) { // solo una professione $matches[1]
$profession = $matches[1];
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE* myFile;
int i;
int j;
char filename[35];
#include <string.h>
#include <stdio.h>
int words(const char sentence[ ])
{
int counted = 0; // result
// state:
const char* it = sentence;
int inword = 0;