Skip to content

Instantly share code, notes, and snippets.

@manmal
manmal / remove_proxies_unless_charles_runs.sh
Last active October 24, 2020 11:08
Remove macOS proxies set by Charles, unless Charles is running
# Whenever Charles is quit unexpectedly (e.g. hard reboot due to kernel panic),
# it leaves its proxy settings active, breaking outbound internet connections.
# This has happened so often to me recently that I decided I need a script for this.
#
# Store this in an .sh file, and make it executable with
# chmod x+ {PATH_TO_FILE}
# I put it in my user's crontab to run every minute (even when logged out):
# echo "* * * * * /Users/{YOUR_USERNAME}/{...}/remove_proxies_unless_charles_runs.sh" | crontab -
# Since I'm impatient, I want this to run every 30 seconds even, so I also added:
# echo "* * * * * sleep 30; /Users/{YOUR_USERNAME}/{...}/remove_proxies_unless_charles_runs.sh" | crontab -
@JunichiIto
JunichiIto / alias_matchers.md
Last active May 9, 2025 08:50
List of alias matchers in RSpec 3

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value
@jacob414
jacob414 / blocks.m
Created May 24, 2012 19:39
With blocks and varargs Objective C might not be as bad after all
#include <stdarg.h>
#import <Foundation/Foundation.h>
@interface Cls : NSObject {}
-(int) takes_block: (int)limit withBlock:(int (^)(int first, ...))block;
@end
@implementation Cls
-(int) takes_block: (int)limit withBlock:(int (^)(int first, ...))block {
@longzheng
longzheng / gist:2308859
Last active December 8, 2017 05:09
Windows 8.1 default XAML templates and styles
<!--
//
// Copyright (c) Microsoft Corporation. All Rights Reserved.
//
-->
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.ThemeDictionaries>