Skip to content

Instantly share code, notes, and snippets.

@neftaly
neftaly / adfreetime_cron.sh
Last active October 17, 2016 09:04
Automatically update Adfreetime.com IP address (for anti-region-blocking)
#!/bin/sh
# Automatically update Adfreetime.com IP address (for anti-region-blocking)
#
# Consider adding the following to /etc/dhcp/dhclient.conf:
# prepend domain-name-servers 192.169.71.180, 208.110.81.50, 192.254.74.200;
#
# Consider adding "ipv6.disable=1" to boot options in "/etc/default/grub",
# Then run "update-grub"
#
@neftaly
neftaly / indented_pre.html
Created October 19, 2014 10:04
Delete \t's in <pre> elements, so that HTML can be indented nicely. Use " " for intentional indents.
<!DOCTYPE html>
<html lang="en">
<head>
<script language="Javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script language="Javascript" src="//cdnjs.cloudflare.com/ajax/libs/prettify/r298/run_prettify.js"></script>
<script language="Javascript">
$(document).ready(function() {
// Delete \t's in <pre> elements, so that HTML can be indented nicely. Use " " for intentional indents.
$("pre.prettyprint").text(function(index, text) {
@neftaly
neftaly / ideas.md
Last active August 29, 2015 14:08
Aether Computing WIP

Aether Computing

Harnessing the theoretical power of imaginary resources.
"Aether Computing" is a conceptual web application paradigm, for highly-available self-scaling web applications. The goal is to move as much server-side processing as possible to the client. The currently-popular "single-page app"/"heavy client" mostly handles display logic - but we want our clients to be processing database calls and business logic while sharing input/output data with peers.

Trust is handled primarily with asymmetric encryption. Primary data, provided by the server, is signed. The server also provides a list of allowed DB users (and their pub keys).

Clients sh

... can clients feasibly be made to run/operate on proprietary algorithms/data via homomorphic encryption? ...

@neftaly
neftaly / ibeacon.sh
Created November 21, 2014 04:44
Fake iBeacon
#!/bin/bash
#sudo apt-get install bluez
sudo hciconfig hci0 up
sudo hciconfig hci0 leadv 3
sudo hcitool -i hci0 cmd 0x08 0x0008 1e 02 01 1a 1a ff 4c 00 02 15 f2 c5 67 e3 32 fb 11 d2 b0 60 d0 f5 a7 10 96 e0 06 00 08 00 c5 00
---
AWSTemplateFormatVersion: "2010-09-09"
Description: "AWS CloudFormation Sample Template CloudWatch_Logs: Provisions a minimal web application, and demonstrates how to stream the provisioning logs (cloud-init.log, cfn-init.log, cfn-hup.log, and cfn-wire.log) to CloudWatch Logs. This eliminates the need to SSH into an EC2 instance for debugging provisioning issues. Simply view the logs in the AWS CloudWatch console. **WARNING** You will be billed for the AWS resources if you create a stack from this template."
Parameters:
InstanceType:
Description: "WebServer EC2 instance type"
Type: "String"
Default: "m1.small"
AllowedValues:
- "t1.micro"

Keybase proof

I hereby claim:

  • I am neftaly on github.
  • I am neftaly (https://keybase.io/neftaly) on keybase.
  • I have a public key whose fingerprint is ABC4 AD34 816C D87D B4AE 34B4 A64F 7165 6D3B 360F

To claim this, I am signing this object:

@neftaly
neftaly / gist:493fabfdf7900c2da5f7
Last active August 29, 2015 14:10
Cross-app messaging

Cross-app messaging allows communication between a browser window (Requester) and a native application (Provider). For example, a web page may wish to read bluetooth data from the users smartphone.

Pre-setup

  • A native data provider app is installed on the phone, and registered to a unique protocol handler. For example, "bthack:---".

Connection init

  • Requester generates a secure random key (or loads the existing key cookie).
  • Requester sends a one-way "access requested" message to Provider via the protocol handler
@neftaly
neftaly / gist:8c008c60048277f63ec2
Last active August 29, 2015 14:10
Generate a secure 128-bit hexadecimal key
/*
Generates a secure random 128-bit hexadecimal key
e.g. "a1ddeb99-14fcd49b-9b5e8e7f-e901bca0"
*/
function generateRandomKey(seed) {
var key = "";
if (window.crypto) {
var key32 = new Uint32Array(4);
@neftaly
neftaly / gist:a9b2f3c6e4295411b9fe
Created November 26, 2014 01:21
bthack client-server promise
var promise = new Promise(function(resolve, reject) {
// Init provider connection
window.location.href = "bthack:" + this.key + "#" + this.appName;
/*
Failsafe: Show a dialog asking the user to install the Provider app.
Make them manually refresh the page when they're done.
*/
$.("#providerAppStoreDialog").show();
@neftaly
neftaly / gist:f74bb26a9704e2fb5242
Last active August 29, 2015 14:11
PlayingArts.com card ripper
function cardimg (card) {
return "<img "
+ "src='http://playingarts.com/images/cards-big/"
+ card.suite + "-"
+ card.name + ".jpg' "
+ "style='width: 25%; display: block; float: left; '>";
}
function map (suites, names) {
output = [];