Skip to content

Instantly share code, notes, and snippets.

View sburlot's full-sized avatar

Stephan Burlot sburlot

View GitHub Profile
@sburlot
sburlot / .lldbinit
Created June 30, 2013 10:25
Macros for lldb
# from https://gist.github.com/mike3k/4513568
# rd: print a recursive description of views
command regex rd 's/^[[:space:]]*$/po [[[UIApplication sharedApplication] keyWindow] recursiveDescription]/' 's/^(.+)$/po [%1 recursiveDescription]/'
# prect: print the properties of a rect
command regex prect 's/(.+)/print (CGRect)%1/'
@sburlot
sburlot / gist:9856a15119985a6f1a87
Created March 22, 2015 23:54
Detect Touch outside a view
@property (nonatomic, strong) UITapGestureRecognizer *gesture;
//==========================================================================================
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
self.gesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
self.gesture.numberOfTapsRequired = 1;
self.gesture.numberOfTouchesRequired = 1;
self.gesture.delegate = self;
@sburlot
sburlot / unban.pl
Created March 7, 2018 00:53
remove an iptable rule, passing an IP address to look for
#!/usr/bin/perl
## unban an IP using iptables
## script will display the iptable command to run, it will not delete the rule (if found)
## Usage: ./unban.pl -ip=123.123.123.123
use Getopt::Long;
@LINES = `iptables -L -n`;
@sburlot
sburlot / send_sms.php
Created December 30, 2012 14:09
PHP script to send SMS via the Infomaniak website. You need to have an account (http://www.infomaniak.ch) and add some credits to send SMS. This script was used to send sms alerts automatically, but you can use to send any sms you want (happy new year, birthday wishes, etc...)
#!/usr/bin/php
# Send SMS messages via Infomaniak.ch
# You need an Infomaniak.ch account and have some credits to send SMS
# Stephan Burlot, http://coriolis.ch Dec, 30 2012
#
<?php
// Username (your email address)
define('USER', 'user@domain.ch');
@sburlot
sburlot / xc_ramdisk.sh
Created March 8, 2014 15:03
Creates a ramdisk and start Xcode with the DerivedData stored in ramdisk. Also deletes the ramdisk and reset Xcode prefs.
#!/bin/bash
# Creates a ramdisk and start Xcode with the DerivedData stored in ramdisk. Also deletes the ramdisk and reset Xcode prefs.
# xc_ramdisk.sh
# - creates a ramdisk, set Xcode DerivedData to this disk and start Xcode.
# - umount a ramdisk, set Xcode DerivedData to default
# Stephan Burlot, Coriolis Technologies, http://www.coriolis.ch
#
# based on Alex Shevchenko xcode_ramdisk.sh script (https://gist.github.com/skeeet/2367298)
# based on Diego Freniche xc-launch.sh script (https://github.com/dfreniche/xc-launch)
#!/usr/bin/perl
# vi:set ts=4 nu:
use strict;
use POSIX 'strftime';
use Net::SSL::ExpireDate;
use Date::Parse;
use Data::Dumper;
use MIME::Lite;
@sburlot
sburlot / s3_bucket_size.pl
Last active April 23, 2024 07:47
Report size of all Amazon S3 buckets with S3CMD
#!/usr/bin/perl
# I use updraft to backup WordPress sites, I need to monitor S3 bucket size because money
# This script will report the size used by all buckets, used to monitor the
# size of all buckets.
# It uses s3cmd https://s3tools.org/s3cmd
# Outputs and send via email the size of all buckets, sorted by size, with
# total size of all buckets
#
# Stephan Burlot sburlot@coriolis.ch Apr 2024
#
@sburlot
sburlot / fastmail_snooze.py
Created April 23, 2024 07:56
Mark snoozed emails from FastMail as UNREAD
#!/usr/bin/python3
# When snoozing a Fastmail ( fastmail.com ) message, mark it as unread so when it appears
# again in the INBOX it's unread and I can see it, instead of being another
# email lost in all my messages
# run it as an hourly cron
# tested with Python 3.10.12
#
# Stephan Burlot sburlot@coriolis.ch Apr 2024
#
@sburlot
sburlot / backblaze_b2_bucket_size.pl
Last active April 23, 2024 07:57
Report size of all Backblaze B3 folders in bucket with S3CMD
#!/usr/bin/perl
# I use updraft to backup WordPress sites, I need to monitor BackBlaze/b2 bucket size because money
# This script will report the size used by all buckets, used to monitor the
# size of all buckets.
# It uses s3cmd https://s3tools.org/s3cmd
# Outputs and send via email the size of all buckets, sorted by size, with
# total size of all buckets
#
# Stephan Burlot sburlot@coriolis.ch Apr 2024
#
@sburlot
sburlot / get_sites_mainwp.php
Created April 23, 2024 08:07
Outputs list of all sites managed with MainWP in a CSV file
#!/usr/bin/env php
<?php
/*
Little helper tool to help me manage all my WordPress sites
Needs MainWP https://mainwp.com/ installed and configured
Creates a CSV file with all sites managed by MainWP
CSV File with site name, url, WP version, PHP version and name of theme
Tested with PHP 8.1.27