Skip to content

Instantly share code, notes, and snippets.

View FirePanther's full-sized avatar
👨‍💻
hi ✌️

Suat Secmen FirePanther

👨‍💻
hi ✌️
View GitHub Profile
@FirePanther
FirePanther / auto-tagger.sh
Created December 1, 2022 00:17
Automatically (macOS-Finder) tag folders, hide them, or exclude them from spotlight and iCloud sync (e.g. node_modules)
#!/bin/bash
# requires: brew install tag
# you can change the source, for me the script is run by my Mac Mini server which only has to tag iCloud Drive documents
source="$HOME/Library/Mobile Documents/com~apple~CloudDocs"
# delete all tags once per day to clean up (if a project doesn't fit anymore)
if [ `date +"%H"` = 0 ]; then
tags=( "Git" "Node" "React" "VueJS" )
<?php
$settings = [];
// svg file
if (isset($_GET['svg'])) {
// general/custom svg file
$svgFile = DIR_ASSETS.'/cdn/dist/svg/'.$_GET['svg'];
if (!preg_match('~^\w[\w/-]+\.svg$~', $_GET['svg']) || !file_exists($svgFile)) die('Invalid svg');
} elseif (isset($_GET['fa'])) {
// fontawesome icon
<?php
// @author: su.at (made for myself)
class Hue {
private static $ip = '___ADD-HUE-IP-ADDRESS-HERE___';
private static $user = '___ADD-USER-ID-HERE___';
// private methods
private static function request($method, $api, $body) {
$url = self::$user.'/'.$api;
@FirePanther
FirePanther / .eslintrc.json
Created September 3, 2018 22:59
my eslint rules and settings
{
"env": {
"browser": true
},
"parserOptions": {
"ecmaVersion": 5
},
"rules": {
"no-undef": 0,
"no-cond-assign": [
@FirePanther
FirePanther / speedtest.php
Created January 11, 2017 14:15
Quickly compare the speed of multiple functions
<?php
/**
* Example output:
* function: file_exists(__FILE__);
* time: 1.39806 seconds
* speed: 39.248 %
*
* function: is_file(__FILE__);
* time: 0.3417 seconds
* speed: 85.152 %
@FirePanther
FirePanther / ToDo-FinderTag.sh
Last active December 10, 2016 02:58
This cron shell script automatically adds a ToDo Finder Tag to all files, which contains a comment like "// todo: replace"
# you will need https://github.com/jdberry/tag for finder tags (and correct the path)
{
grep -rlIi --null -E -e "(\#|//|/\*\*?)\s*todo\b" --exclude-dir="Library" --exclude-dir="node_modules" --include=\*.{php,js,css,htm,html} "$HOME" | xargs -0 .../execs/tag -a "ToDo"
} &> /dev/null
@FirePanther
FirePanther / suat.be-FinderTags.sh
Last active December 10, 2016 02:58
I recently moved to another Domain (from suat.be to su.at). This cron script automatically adds a "suat.be" Finder tag to all files which contains this string (so I can replace it with su.at)
# you will need https://github.com/jdberry/tag for finder tags (and correct the path)
{
grep -rlI --null "suat.be" --exclude-dir=".git" --exclude-dir="Library" --exclude-dir="Mail Attachments" --exclude-dir="Paperwork" --exclude="*.log" --exclude="*.eml" --exclude="minibackups.sh" "$HOME" | xargs -0 .../execs/tag -a "suat.be"
} &> /dev/null
@FirePanther
FirePanther / autoFinderGitTag.sh
Last active November 19, 2016 17:23
Automatically adds a Finder "Git" Tag to all your repos
#!/bin/bash
# requires 'tag' binary from https://github.com/jdberry/tag
# auto git tag
{
find $HOME -type d \
! -path '*Trash' \
-name ".git" -exec dirname {} \; | while read line; do \
./tag -a Git "$line"; done
<?php
sd('./', parseFile);
/**
* recursive scandir
*/
function sd($d, $cb) {
$s = scandir($d);
foreach ($s as $f) {
if ($f[0] == '.') continue;
@FirePanther
FirePanther / permanentlyDelete.gs
Last active November 8, 2016 01:17
Permanenty delete some Google Drive files from the trash. After I've watched the Videos in my YouTube folder I remove them but they still take much space in my Google Drive.
/**
* Permanenty delete some Google Drive files from the trash.
*/
function run() {
var trashed = DriveApp.getTrashedFiles();
while (trashed.hasNext()) {
parseTrashedFile(trashed.next());
}
}