Skip to content

Instantly share code, notes, and snippets.

View kmgalanakis's full-sized avatar

Konstantinos Galanakis kmgalanakis

View GitHub Profile
@kmgalanakis
kmgalanakis / install.sh
Last active June 7, 2019 21:09
Codenvy server setup
#!/bin/sh
apt-get update
echo "\e[96mInstalling git \e[39m"
apt-get install -y git
echo "\e[96mInstalling php \e[39m"
apt-get install -y php
@kmgalanakis
kmgalanakis / resilio_sync_on_rpi.txt
Last active May 12, 2018 08:46
Install Resilio Sync on the RPi
sudo echo "deb http://linux-packages.resilio.com/resilio-sync/deb resilio-sync non-free" | sudo tee /etc/apt/sources.list.d/resilio-sync.list
sudo wget -qO - https://linux-packages.resilio.com/resilio-sync/key.asc | sudo apt-key add -
sudo apt-get update
sudo dpkg --add-architecture armel
sudo apt-get update
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@kmgalanakis
kmgalanakis / gist:793dfe2636f54ee8bca5
Created March 12, 2015 08:41
Run PHP cron tasks without cron available
<?php
ob_start();
// Generage HTML page here
generate_full_html_page();
// All magic goes here
$output = ob_get_clean();
ignore_user_abort(true);
set_time_limit(0);
@kmgalanakis
kmgalanakis / gist:936cbce4ad8d1dd20904
Last active August 29, 2015 14:16
Unpacking base_64 encoded integers and booleans
<?php
$data = "AAAB4Q==";
$raw = base64_decode($data);
print_r(unpack('Nint',$raw));
echo "<br/>";
$data = "AQ==";
$raw = base64_decode($data);
print_r(unpack('Cbool',$raw));
@kmgalanakis
kmgalanakis / gist:88c059cd9892d075e115
Created March 12, 2015 08:35
Convert strange encoded databe sql file to UTF-8 (Greek Characters included)
<?php
// helper function for utf-8
function file_get_contents_utf8($fn) {
$content = file_get_contents($fn);
return mb_convert_encoding($content, 'UTF-8',
mb_detect_encoding($content, 'UTF-8, ISO-8859-1', true));
}
// open corrupted text file
$string = file_get_contents_utf8("input_file.sql");