Skip to content

Instantly share code, notes, and snippets.

@joashp
joashp / openssl_encrypt_decrypt.php
Created September 4, 2015 15:59
Simple PHP encrypt and decrypt using OpenSSL
<?php
/**
* simple method to encrypt or decrypt a plain text string
* initialization vector(IV) has to be the same when encrypting and decrypting
*
* @param string $action: can be 'encrypt' or 'decrypt'
* @param string $string: string to encrypt or decrypt
*
* @return string
*/
@rubenve
rubenve / hhvm-3.2-centos-plesk.txt
Last active May 8, 2018 06:20
Installing HHVM 3.2.0 on CentOS 6 with Plesk 11.5
# How to install the hhvm package using yum on CentOS 6.6 with Plesk 11.5
# Note that you can also install hhvm from source. For that check the official guides here:
# https://github.com/facebook/hhvm/wiki/Building-and-installing-HHVM-on-CentOS-6.6#13-install-ocaml
cd /etc/yum.repos.d
sudo wget http://www.hop5.in/yum/el6/hop5.repo
yum clean all
storefront = {
'AL':'143575',
'DZ':'143563',
'AO':'143564',
'AI':'143538',
'AG':'143540',
'AR':'143505',
'AM':'143524',
'AU':'143460',
'AT':'143445',
@cmpscabral
cmpscabral / download.php
Last active April 11, 2021 22:39
on the fly zip stream download
<?php
//
// taken from http://stackoverflow.com/questions/4357073/on-the-fly-zipping-streaming-of-large-files-in-php-or-otherwise
//
// make sure to send all headers first
// Content-Type is the most important one (probably)
//
header('Content-Type: application/octet-stream');
header('Content-disposition: attachment; filename="file.zip"');
@nucreativa
nucreativa / spinner.html
Created May 26, 2015 08:18
Simple CSS Spinner
<div class="spinner">
<div class="rect1"></div>
<div class="rect2"></div>
<div class="rect3"></div>
<div class="rect4"></div>
<div class="rect5"></div>
</div>
<style>
.spinner {
margin: 100px auto;
@edin-m
edin-m / html5-video-play-file-blob.html
Last active May 17, 2024 07:45
HTML video play file blob object url
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<video></video>
<br/>
<input type="file" name="file" id="fileItem" onchange="onChange()" >
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@HasStacey
HasStacey / JS Countdown timer with PHP variables
Last active August 16, 2020 08:30
Create a JS countdown timer driven by PHP variables
<?php
$year = 2014;
$month = 10;
$day = 21;
$hour = 14;
$min = 00;
$sec = 00;
$target = mktime($hour, $min, $sec, $month, $day, $year);
$current = time();
@anderZubi
anderZubi / transmission_install.sh
Last active September 9, 2024 07:36
Script to install Transmission BitTorrent client in WD MyCloud NAS
#!/bin/bash
echo Backing up your sources.list...
cp /etc/apt/sources.list /etc/apt/sources.list.bak
echo Adding the sid repo to sources.list...
echo deb http://ftp.us.debian.org/debian/ sid main >> /etc/apt/sources.list
echo Updating the sid packages list...
apt-get update
@mossspence
mossspence / JSON.mte
Last active October 23, 2023 10:01 — forked from jmorenoamor/JSON.mte
MP3Tag export script for generating a JSON, updated for my usage and JSONLint validation
$filename(json,utf-8){$loop(%_filename_ext%)$puts(CountMax,%_counter%)$loopend()
"numSongs": $get(CountMax),
"songs": '['
$loop(%_filename_ext%) {
"title": "%title%",
"album": "%album%",
"artist": "%artist%",
"album_artist": "%albumartist%",
"composer": "$meta(composer,1)",
"publisher": "%publisher%",