Skip to content

Instantly share code, notes, and snippets.

@jefflarkin
jefflarkin / gpio.sh
Last active April 13, 2018 22:15
BASH functions for using the C.H.I.P. GPIO pins.
#!/bin/bash
#FIXME Add usage() function to improve documentation
# Enable exposure of the specified GPIO pin (0-8)
gpio_enable()
{
if [[("$1" -lt 0) || ("$1" -gt 8)]] ; then
echo "Valid pins are 0-8"
return -1;
fi
@steipete
steipete / gist:99f8aa8d6527fa027fd6
Last active August 29, 2015 14:25
Mirror for https://forums.developer.apple.com/thread/11098 since that needs moderation first (submitted Jul 16 2015)
We're working on supporting Bitcode in PSPDFKit but hit a blocking issue with OpenSSL (latest 1.0.2d).
We're using a script that downloads and builds OpenSSL into fat static libraries for both Mac and iOS. I've put the gist here:
https://gist.github.com/steipete/ce09ba176a4b8ef66b2d/bf053eab1c0f8494dcd3748079543c4ed4367b9c
Enabling Bitcode should be as easy as adding `-fembed-bitcode` as clang flag according to this entry. That's exactly what I did.
Now things build, but the script eventually stops with this error:
ld: could not open bitcode temp file: ../libcrypto.a(aes-x86_64.o) for architecture x86_64
anonymous
anonymous / blockerList.json
Created June 25, 2015 00:05
Testing Safari Content Blocker on iMore.com
[
{
"action": {
"type": "block"
},
"trigger": {
"url-filter": ".*",
"resource-type": ["script"],
"load-type": ["third-party"],
"if-domain": ["imore.com"]
//
// YapRTreeTest.swift
// YapDatabaseRTreeTest
//
// Created by Maël Primet on 06/19/15.
// Copyright (c) 2015 Snips. All rights reserved.
//
import Foundation
@rbranson
rbranson / gist:03d88e3733c6ee098a89
Last active July 25, 2017 15:17
My Thoughts on Rust

Rust is the first language that has emerged in the past few years that solves enough of my problems that it would be worth not only learning & teaching an entirely new language, but also sacrificing the maturity of the language ecosystems I’ve become accustomed to.

I highly suggest you read the "Guide" provided by the language developers or this won't make much sense. These are just some of my thoughts and are intended to highlight particular things that stand out to me. I am just a practitioner and not an expert in any of these languages, so I have probably made some incorrect assumptions and out-of-date assertions. Bare with me.

Rust feels like the first time momentum has gained behind a true systems programming language that uses modern PL design techniques to prevent common errors when dealing with memory. It seems like others have previously either been too anemic to be worth adopting or too abstract to provide proper control. The type system and assignment semantics are designed specifically to preven

@dferg
dferg / howto-tomato-l2tp-ipsec-server.markdown
Last active December 18, 2023 21:49
HOWTO: Install L2TP/IPsec Server on TomatoUSB

Introduction

This howto describes setting up a LT2P over IPsec VPN server on your router with TomatoUSB firmware. This should allow you to connect using the built-in client to your Mac, iPhone or Android device. (Not sure about Windows.)

At the end of this tutorial, you should have a L2TP/IPsec VPN server that starts automatically on boot. Mac/iPhone/Android devices can connect with their native client and will be assigned an IP address within your LAN subnet. They should be able to talk to other devices on your LAN and should be able to contact hosts on the Internet NAT'd behind your WAN IP address.

Requirements

  • Router running Shibby's fork of TomatoUSB
  • entware installed to a USB stick mounted at /opt (howto)
@labeneator
labeneator / ps_to_pdf_content_protected_pdfs.sh
Last active March 20, 2021 12:47
Getting around Adobe's document protection schemes
############ Adobe badness #############
# In your operating system, create a postscript printer whose address is 127.0.0.1
# Fake a postscript printer using netcat
$ nc -l 127.0.0.1 9100 > printout.ps
# Print your pdf using Adobe Reader to the postscript printer on 127.0.0.1
# Netcat will diligently dump the printout to printout.ps as a postscript file
@chrisballinger
chrisballinger / gist:7239932
Last active February 27, 2024 22:21
French Encryption Import Compliance

Starting in the first week of July, apps that meet the following criteria are required to comply with French Encryption Laws/Regulations if you intend to distribute your app in France.

This requirement applies to apps that use, access, implement, or incorporate:

  1. Any encryption algorithm that is yet to be standardized by international standard bodies such as IEEE, IETF, ISO, ITU, ETSI, 3GPP, TIA, etc. or not otherwise published; or
  2. Standard (e.g., AES, DES, 3DES, RSA) encryption algorithm(s) instead of or in addition to accessing or using the encryption in iOS and/or Mac OS X

Apple will require you to upload a copy of your approved French declaration when you submit your app to the App Store. Relevant French encryption regulations can be found at:

@sevastos
sevastos / aws-multipartUpload.js
Last active October 8, 2023 10:43
Example AWS S3 Multipart Upload with aws-sdk for Node.js - Retries to upload failing parts
// Based on Glacier's example: http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/examples.html#Amazon_Glacier__Multi-part_Upload
var fs = require('fs');
var AWS = require('aws-sdk');
AWS.config.loadFromPath('./aws-config.json');
var s3 = new AWS.S3();
// File
var fileName = '5.pdf';
var filePath = './' + fileName;
var fileKey = fileName;
@ericallam
ericallam / CLLocationManager+MockingLocation.h
Created June 1, 2013 03:57
Mocking out CLLocationManager
#import <CoreLocation/CoreLocation.h>
extern CLLocationDegrees kMockedLatitude;
extern CLLocationDegrees kMockedLongitude;
@interface CLLocationManager (MockingLocation)
+ (BOOL)custom_locationServicesEnabled;
+ (CLAuthorizationStatus)custom_authorizationStatus;
-(void)custom_startUpdatingLocation;