Skip to content

Instantly share code, notes, and snippets.

View tuefekci's full-sized avatar

Giacomo Tüfekci tuefekci

View GitHub Profile
@tuefekci
tuefekci / gist:ddd83aee781fb37f531cc43b11da2168
Last active February 26, 2022 17:04 — forked from Mecanik/gist:d2314fbc860b9c68eac4b101127b738e
Install and configure PHP 7.3 ev/event PECL extension on Ubuntu Linux 18.04.3
# For phpize
apt install php7.4-dev
# Install extensions
pecl install ev
pecl install event
# Create configurations
sudo echo 'extension=ev.so' > /etc/php/7.4/mods-available/ev.ini
sudo echo 'extension=event.so' > /etc/php/7.4/mods-available/event.ini
@tuefekci
tuefekci / storagespaces.ps1
Created October 29, 2021 07:13
Win10 StorageSpace+SSDCache
# RUN AS ADMINISTRATOR
# based on https://nils.schimmelmann.us/post/153541254987/intel-smart-response-technology-vs-windows-10
# Tested with one SSD and one HDD
#
#Pool that will suck in all drives
$StoragePoolName = "My Storage Pool"
#Tiers in the storage pool
$SSDTierName = "SSDTier"
$HDDTierName = "HDDTier"
#Virtual Disk Name made up of disks in both tiers
dconf write /org/gnome/shell/extensions/panel-date-format/format "'%d.%m.%Y %H:%M'"
@tuefekci
tuefekci / mongoDBBackup.php
Last active November 30, 2018 04:31
mongodb php backup
/**
*
* @copyright Copyright (c) 2018. Giacomo Tüfekci (https://www.tuefekci.de)
* @github https://github.com/tuefekci
* @license https://www.tuefekci.de/LICENSE.md
*
*/
// IMPORTANT: $this->filesystem needs to be adapted to use case! Also this is not intended for Production Use!
// TODO: For productive use add Exception handling etc. depended on use case.
@tuefekci
tuefekci / nav-menu-item-custom-fields.php
Created November 18, 2016 13:34 — forked from kucrut/nav-menu-item-custom-fields.php
Proof of concept for how to add new fields to nav_menu_item posts in the WordPress menu editor.
<?php
/**
* Proof of concept for how to add new fields to nav_menu_item posts in the WordPress menu editor.
* @author Weston Ruter (@westonruter), X-Team
*/
add_action( 'init', array( 'XTeam_Nav_Menu_Item_Custom_Fields', 'setup' ) );
class XTeam_Nav_Menu_Item_Custom_Fields {
static $options = array(
@tuefekci
tuefekci / QRLogo.php
Created May 11, 2016 21:24 — forked from NTICompass/QRLogo.php
QR Code + Logo Generator
<?php
/**
* QR Code + Logo Generator
*
* http://labs.nticompassinc.com
*/
$data = isset($_GET['data']) ? $_GET['data'] : 'http://labs.nticompassinc.com';
$size = isset($_GET['size']) ? $_GET['size'] : '200x200';
$logo = isset($_GET['logo']) ? $_GET['logo'] : FALSE;
@tuefekci
tuefekci / php-full-depth-case-insensitive-file-exists.php
Created February 19, 2016 11:15 — forked from jrsinclair/php-full-depth-case-insensitive-file-exists.php
PHP Full-depth Case Insensitive file_exists() Function
<?php
/**
* Single level, Case Insensitive File Exists.
*
* Only searches one level deep. Based on
* https://gist.github.com/hubgit/456028
*
* @param string $file The file path to search for.
*
* @return string The path if found, FALSE otherwise.
@tuefekci
tuefekci / rsync-examples.sh
Created February 19, 2016 11:15 — forked from jrsinclair/rsync-examples.sh
Using Rsync over SSH
rsync -rlptuvhz -e ssh username@my-dev-server.dev:/path/to/dir .
# -r Recursive
# -l Copy symlinks as symlinks
# -p Copy permisisons
# -t Copy times
# -u Update. Skip files that are newer on receiving end.
# -v Verbose.
# -h Output numbers in a human-readable format
# -z Use compression when sending data over the network.
@tuefekci
tuefekci / level8.js
Created January 13, 2016 23:10
elevator level8.js - still like level4
{
init: function(elevators, floors) {
console.log(elevators);
// # Elevators
elevators.forEach(function(elevator) {
elevator.on("stopped_at_floor", function(floorNum) {
if(elevator.destinationQueue.indexOf(floorNum) !== -1) {
elevator.destinationQueue.splice(elevator.destinationQueue.indexOf(floorNum), 1);
}
});
@tuefekci
tuefekci / level7.js
Created January 13, 2016 23:09
elevator level7.js - still like level4 probably last time it works without optimazations
{
init: function(elevators, floors) {
console.log(elevators);
// # Elevators
elevators.forEach(function(elevator) {
elevator.on("stopped_at_floor", function(floorNum) {
if(elevator.destinationQueue.indexOf(floorNum) !== -1) {
elevator.destinationQueue.splice(elevator.destinationQueue.indexOf(floorNum), 1);
}
});