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:59f71d78e0a2e514e83d6681f8b7bc0a
Created October 14, 2022 17:05
Factorio MoonLogic if red['signal-enemy-unit-spawner'] > 0 or red['signal-enemy-turret'] > 0 or red['signal-enemy-unit'] > 0 then
out = {}
local ressource = 0
if red['signal-enemy-unit-spawner'] > 0 or red['signal-enemy-turret'] > 0 or red['signal-enemy-unit'] > 0 then
ressource = 1
else
out['signal-x-tile'] = red['signal-x-tile']
out['signal-y-tile'] = red['signal-y-tile']
end
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
import fs from 'fs';
const { Innertube, UniversalCache } = require('youtubei.js');
(async () => {
const youtube = await Innertube.create({
@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.