Skip to content

Instantly share code, notes, and snippets.

from flask import Flask, send_from_directory
import os
app = Flask(__name__)
app.debug = True
_file_directory = 'files/'
@app.route('/')
def directory():
@hirobert
hirobert / NounProjectAPI.cs
Created March 5, 2015 22:50
NounProjectAPI.cs
//taken from https://github.com/KaneQc/Noun-Project-API/blob/master/NounProjectAPI.cs
using RestSharp;
using RestSharp.Authenticators;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Request
from flask import make_response
def cors_response(data):
response = make_response(data)
response.headers['Access-Control-Allow-Origin'] = '*'
return response
// taken from https://github.com/erndev/NounSample/blob/master/NounSample/NounApiClient.swift
//
// NounApiClient.swift
// NounSample
//
// Created by ERNESTO GARCIA CARRIL on 9/10/15.
// Copyright © 2015 ernesto. All rights reserved.
//
import AppKit
@hirobert
hirobert / .env
Created January 10, 2019 00:45 — forked from schavery/.env
New Relic RQ setup
NEW_RELIC_LICENSE_KEY=6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5
NEW_RELIC_LOG=stdout
NEW_RELIC_APP_NAME=proj--staging
@hirobert
hirobert / ubuntu-docker-credential-desktop-fix.md
Created July 21, 2022 19:19
How to fix Ubuntu docker-credential-desktop error

How to fix Ubuntu docker-credential-desktop error

Errors:

failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to create LLB definition: rpc error: code = Unknown desc = error getting credentials - err: exec: "docker-credential-desktop": executable file not found in $PATH, out: ``
Error saving credentials: error storing credentials - err: exec: "docker-credential-desktop": executable file not found in $PATH, out: ``
@hirobert
hirobert / aws-load-balancer-elb-alb-target-group-target-currently-in-use-by-a-listener-or-a-rule.md
Last active August 25, 2022 22:58
aws load balancer (elb/alb) target group - target currently in use by a listener or a rule

This is likely happening because there are still rules associated with the load balancer that are using the target group. Unfortunately there is currently on way in the AWS console to view or edit the rules. Here is another approach:

  1. Install AWS cli: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
  2. If you have different profiles, add --profile=name_of_profile on each of the following commands
  3. aws elbv2 describe-load-balancer, get the load balancer arn
  4. aws elbv2 describe-listeners --load-balancer-arn arn:aws:elasticloadbalancing:this_is_the_load_balancer_arn, get listener arn for the listener which you associated with the target group
  5. aws elbv2 describe-rules --listener-arn arn:aws:elasticloadbalancing:this_is_the_listener_arn, get the rule arn which should contain the name of the target group you are looking to remove
  6. aws elbv2 delete-rule --rule-arn arn:aws:elasticloadbalancing:this_is_the_rule_arn
@hirobert
hirobert / OAuth.php
Last active February 6, 2023 07:35
Noun Project API - PHP Example
<?php
// mirror of: http://oauth.googlecode.com/svn/code/php/OAuth.php
// vim: foldmethod=marker
/* Generic exception class
*/
class OAuthException extends Exception {
// pass
}
var OAuth = require('oauth')
// `npm install oauth` to satisfy
// website: https://github.com/ciaranj/node-oauth
var KEY = "<INSERT KEY HERE>"
var SECRET = "<INSERT SECRET HERE>"
var oauth = new OAuth.OAuth(
'http://api.thenounproject.com',
'http://api.thenounproject.com',
// adapted from https://github.com/KaneQc/Noun-Project-API/blob/master/NounProjectAPI.cs
using RestSharp;
using RestSharp.Authenticators;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Request