Skip to content

Instantly share code, notes, and snippets.

View danpette's full-sized avatar

Dan-Petter Jacobsen danpette

View GitHub Profile
[
{
"Id": "America/Scoresbysund",
"StandardName": "East Greenland Standard Time",
"DisplayName": "(UTC-01:00) East Greenland Time (Ittoqqortoormiit)",
"BaseUtcOffset": "-01:00:00",
"IsWindowsTimezone": false
},
{
"Id": "Cape Verde Standard Time",
/////////////////////////////////////////////////////////////////
//////////////////////////////// CPU ////////////////////////
/////////////////////////////////////////////////////////////////
# Scaleway ARM 2.99 Euro
# Cpu: 4 Dedicated
# 50 GB SSD Virtual
#Threads: 1
//graph1, graph2 are Chart instance
//modal is a global modal = $(this); from within $('.yourdiv').on('shown', function(event){ ....
//generateChart is method setting graph1 to new Chart.
//if dynamic/many charts make this dynamic, in this example i will always try to load both tabs, logic for only generating current should be implementet :)
$('#statistics-tabs a').click(function (e) {
e.preventDefault();
$(this).tab('show');
setTimeout(function(){
if(graph1 != undefined) graph1.destroy();
if(graph2 != undefined) graph2.destroy();
//Requires jquery and bootsteap 3.2+
var modal_ok = 'Confirm';
var modal_abort = 'Abort';
var ok_text = '';
var modals = 0;
function ModalAlert(title, message, confirm, success_function, size, init_ok_disabled, ok_text) {
modals++;
var is_confirm_modal = (confirm !== undefined && confirm != null && confirm === true) ? true : false;
var size = (size !== undefined && size != null) ? ' ' + size : '';
<?php
$Log->addInfo('backup_daily_start');
use Aws\Glacier\GlacierClient;
use Aws\Common\Enum\Region;
use Aws\S3\S3Client;
use Ifsnop\Mysqldump as IMysqldump;
try {
$timestamp = date('Y-m-d H:i:s');
try {
$dump = new IMysqldump\Mysqldump('database', 'username', 'password', 'localhost','mysql',[],[
@danpette
danpette / ubuntu_php_upgrade_with_mongo_pecl.txt
Created July 23, 2015 15:05
Update to latest php when having mongo pecl installed on ubuntu
#Step 1
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php5-5.6
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install php5
#step 2
apt-get update
apt-get install php5-dev
@danpette
danpette / deploy.sh
Created July 16, 2015 08:47
deploy sudo
#create build folder
mkdir deploy
#download latest version
git clone blablabla deploy
#composer
php composer self-update
php composer update
#deploy new version
mv deploy /
#Clean
@danpette
danpette / ubuntu_1404_lemp_node.txt
Last active August 29, 2015 14:18
Ubuntu LEMP Node V1
#Require: Ubuntu 14.04
#nginx
sudo apt-get update
sudo apt-get install nginx
sudo service nginx start
#Timezone
sudo dpkg-reconfigure tzdata
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Linq.Expressions;
using System.Web;
namespace Admin.Helpers
{
public class IQueryablePropertyHelper
@danpette
danpette / amazone_3s_file_upload_class.php
Created March 3, 2015 08:32
Amazone S3 file upload class
<?php
namespace Somewhere\Model;
class Upload {
public function __construct() {}
public function addFile($post_name, $directory = '/usr/share/nginx/files/') {
global $s3, $Log; //S3 library and Monolog