Skip to content

Instantly share code, notes, and snippets.

View OnlyInAmerica's full-sized avatar

David Brodsky OnlyInAmerica

  • Oakland, CA
View GitHub Profile
@OnlyInAmerica
OnlyInAmerica / build_output.sh
Last active August 29, 2015 14:22
Debugging a libtool error while building Apache Thrift 0.9.2 for Mac OS X
$ ./configure --prefix=/usr/local/ --with-boost=/usr/local --with-libevent=/usr/local
...
$ make
...
/bin/sh ../../../libtool --tag=CXX --mode=link g++ -Wall -Wextra -pedantic -g -O2 -std=c++11 -L/usr/local/lib -o processor_test processor/ProcessorTest.o processor/EventLog.o processor/ServerThread.o libprocessortest.la ../../../lib/cpp/libthrift.la ../../../lib/cpp/libthriftnb.la -L/usr/local/lib -levent -l:libboost_unit_test_framework.a -lssl -lcrypto -lpthread
libtool: link: g++ -Wall -Wextra -pedantic -g -O2 -std=c++11 -o .libs/processor_test processor/ProcessorTest.o processor/EventLog.o processor/ServerThread.o -Wl,-bind_at_load -L/usr/local/lib ./.libs/libprocessortest.a ../../../lib/cpp/.libs/libthrift.dylib ../../../lib/cpp/.libs/libthriftnb.dylib -levent -l:libboost_unit_test_framework.a -lssl -lcrypto -lpthread
ld: library not found for -l:libboost_unit_test_framework.a
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[4]: *** [processor_test] Error 1
make[3]
@OnlyInAmerica
OnlyInAmerica / hot_springs.geojson
Last active December 28, 2015 11:19
California Hot Springs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@OnlyInAmerica
OnlyInAmerica / Mirror Vector Shader
Created April 8, 2016 02:07
A Vertex shader that mirrors its source horizontally
private static final String FRAGMENT_SHADER_MIRROR =
"#extension GL_OES_EGL_image_external : require\n" +
"precision mediump float;\n" +
"varying vec2 vTextureCoord;\n" + // Coordinate within texture
"uniform samplerExternalOES sTexture;\n" + // Texture
"uniform vec2 uPosition;\n" + // Position within OpenGL scene
"void main() {\n" +
" vec2 texCoord = vTextureCoord.xy;\n" +
" vec2 normCoord = 2.0 * texCoord - 1.0;\n"+
" normCoord.x = normCoord.x * sign(normCoord.x + uPosition.x);\n"+
@OnlyInAmerica
OnlyInAmerica / Account.java
Last active April 19, 2016 23:56
Java Wrapping Matrix's Olm using SWIG
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.8
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
public class Account {
@OnlyInAmerica
OnlyInAmerica / Olm.i
Created May 3, 2016 20:17
A SWIG interface file to map Matrix's olm C interface to Java
/*
* Call swig: "swig -java -c++ -package org.chatsecure.olmwrapper -outdir ~/Code/olmJava olm.i"
*/
%module olmwrapper
%{
/* Put headers and other declarations to include in the wrapper code here */
#include "olm.hh"
};
@OnlyInAmerica
OnlyInAmerica / delete_iam_users.py
Created May 12, 2015 21:31
Delete old IAM AWS users
import boto.iam
'''
Delete the NUM_USERS_TO_DELETE oldest IAM users in your account*
*IMPORTANT: The boto iam api appears to only allow querying 1000 users
at a time so if you have over 1000 IAM users there is no guarantee these
will be the oldest. The deleted users are only guaranteed to be the oldest
among the 1000 aws returns us.
@OnlyInAmerica
OnlyInAmerica / facebook.py
Created February 9, 2012 23:30 — forked from rodbegbie/facebook.py
Hacked version of "official" (but now unsupported) Facebook Python SDK to support OAuth 2.0
#!/usr/bin/env python
#
# Copyright 2010 Facebook
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@OnlyInAmerica
OnlyInAmerica / gist:3dadd26fddb29c0f777d
Last active January 24, 2022 18:18
Get Thumbnail from Android Storage Access Framework file using MediaStore
if (/* your media path came from Android Storage Access Framework on 4.4+ */) {
//mediaFile.getPath() = "content://com.android.providers.media.documents/document/video:183"
long videoId = Long.parseLong(Uri.parse(mediaFile.getPath()).getLastPathSegment().split(":")[1]);
Bitmap thumbnail = MediaStore.Video.Thumbnails.getThumbnail(mContext.getContentResolver(),
videoId,
MediaStore.Images.Thumbnails.MINI_KIND, // 512 x 384
//MediaStore.Images.Thumbnails.MICRO_KIND, // 96 x 96
null)); // BitmapFactory.Options
@OnlyInAmerica
OnlyInAmerica / find_iam_user.py
Created April 3, 2014 22:52
Find an AWS IAM user corresponding to an AWS Access Key
# Find the IAM username belonging to the TARGET_ACCESS_KEY
# Useful for finding IAM user corresponding to a compromised AWS credential
# Requirements:
#
# Environmental variables:
# AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
# python:
# boto
@OnlyInAmerica
OnlyInAmerica / make-mega-adblock-hostsfile.sh
Last active September 30, 2023 23:29
Create Mega Adblock Hostsfile for use with Dnsmasq (Modified from Pi-hole)
#!/bin/bash
# Modified Pi-hole script to generate a generic hosts file
# for use with dnsmasq's addn-hosts configuration
# original : https://github.com/jacobsalmela/pi-hole/blob/master/gravity-adv.sh
# The Pi-hole now blocks over 120,000 ad domains
# Address to send ads to (the RPi)
piholeIP="192.168.1.1"
outlist='./final_blocklist.txt'