Skip to content

Instantly share code, notes, and snippets.

@jimmycuadra
jimmycuadra / cloud-config.yml
Last active April 19, 2021 03:04
CoreOS cloud-config for DigitalOcean with iptables firewall
#cloud-config
coreos:
etcd:
# generate a new token for each unique cluster from https://discovery.etcd.io/new
discovery: https://discovery.etcd.io/<token>
# multi-region deployments, multi-cloud deployments, and droplets without
# private networking need to use $public_ipv4
addr: $private_ipv4:4001
peer-addr: $private_ipv4:7001
@samselikoff
samselikoff / future-proof.md
Last active April 21, 2023 17:14
Future-proofing your Ember 1.x code

This post is also on my blog, since Gist doesn't support @ notifications.


Components are taking center stage in Ember 2.0. Here are some things you can do today to make the transition as smooth as possible:

  • Use Ember CLI
  • In general, replace views + controllers with components
  • Only use controllers at the top-level for receiving data from the route, and use Ember.Controller instead of Ember.ArrayController or Ember.ObjectController
  • Fetch data in your route, and set it as normal properties on your top-level controller. Export an Ember.Controller, otherwise a proxy will be generated. You can use Ember.RSVP.hash to simulate setting normal props on your controller.
@hbrunn
hbrunn / rebuild_libreoffice.sh
Last active November 10, 2020 05:16
This is an instruction how to rebuild libreoffice on ubuntu trusty to use python-uno for python 2.7
# we need some fixes from 14.10
sudo add-apt-repository --enable-source ppa:libreoffice/libreoffice-4-3
# fetch this repository
sudo apt-get update
# update your libreoffice installation
sudo apt-get install libreoffice
# get all build dependencies for libreoffice
sudo apt-get build-dep libreoffice
# that strangely enough doesn't come with the above
sudo apt-get install gcj-jdk python-dev
# If you open your Ressource monitoring under OSX, you'll see that the
# Process "Spotify Helper" is eating between 20% and 30% of CPU constantly
# It means that when you're on battery, it'll drain it faster.
# To prevent the Spotify Helper (which are basically ads for spotify) from spawning process,
# you should disable access to the app doing this (close Spotify first) :
sudo chmod 000 "/Applications/Spotify.app/Contents/Frameworks/Spotify Helper EH.app"
sudo chmod -N "/Applications/Spotify.app/Contents/Frameworks/Spotify Helper EH.app"
@simon-weber
simon-weber / externalcall.py
Last active November 24, 2018 21:52
Custom tooling to ease VCR.py management.
import vcrutils
VCR_CASSETTE_PATH = APPROOT + '/venmo_tests/cassettes/' # eg
MAKE_EXTERNAL_REQUESTS = os.environ.get('MAKE_EXTERNAL_REQUESTS') == 'TRUE'
@dual_decorator # convert a paramaterized decorator for no-arg use (https://gist.github.com/simon-weber/9956622).
def external_call(*args, **kwargs):
"""Enable vcrpy to store/mock http requests.
@Kobold
Kobold / write_restricted_model_serializer.py
Created February 26, 2014 20:34
A default read-only serializer for django-rest-framework as of DRF 2.4.
class RestrictedSerializerOptions(serializers.ModelSerializerOptions):
"""
Meta class options for ModelSerializer
"""
def __init__(self, meta):
super(RestrictedSerializerOptions, self).__init__(meta)
self.writable_fields = getattr(meta, 'writable_fields', ())
class WriteRestrictedModelSerializer(serializers.ModelSerializer):
import re
from django.conf import settings
from django.core import cache as django_cache
from mock import patch
from rest_framework.permissions import SAFE_METHODS
from rest_framework.response import Response
class CachedResourceMixin (object):
@property
@beng
beng / autolog.py
Last active April 3, 2023 16:28 — forked from brendano/autolog.py
modified from the original to remove the use of global variables, implement a logging class instead of relying on sys.stdout, remove the function log decorator, remove the module log decorator, allow color changing on any log call, allow indentation level changing on any log call, and PEP-8 formatting.
# Written by Brendan O'Connor, brenocon@gmail.com, www.anyall.org
# * Originally written Aug. 2005
# * Posted to gist.github.com/16173 on Oct. 2008
# Copyright (c) 2003-2006 Open Source Applications Foundation
#
# 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
#
@elbuo8
elbuo8 / doapi.sh
Created November 30, 2013 01:58
Simple script to get all the Ansible requirements for DigitalOcean
endpoints=(sizes regions images ssh_keys)
for i in "${endpoints[@]}"; do
url=`printf "https://api.digitalocean.com/%s/?client_id=%s&api_key=%s" $i $DO_CLIENT_ID $DO_API_KEY`
curl $url | python -mjson.tool
done
@bomberstudios
bomberstudios / sketch-plugins.md
Last active February 26, 2024 07:02
A list of Sketch plugins hosted at GitHub, in no particular order.