Skip to content

Instantly share code, notes, and snippets.

@jinhwanlazy
jinhwanlazy / filter_algospot.py
Last active August 29, 2015 14:23
filter problems solved with python but not by me from algospot.com
import requests
from bs4 import BeautifulSoup as bs
from itertools import chain, filterfalse
langs = {'python': ['(py)', '(pypy)', '(py3)'],
'ruby': ['(rb)']}
def get_pids(maxpage=17):
import requests
from bs4 import BeautifulSoup as bs
from itertools import chain, filterfalse
langs = {'python': ['(py)', '(pypy)', '(py3)'],
'ruby': ['(rb)']}
def get_pids(maxpage=17):
@andrewmichaelsmith
andrewmichaelsmith / 000-default.conf
Last active October 27, 2015 15:54
graphite setup
# This needs to be in your server's config somewhere, probably
# the main httpd.conf
# NameVirtualHost *:80
# This line also needs to be in your server's config.
# LoadModule wsgi_module modules/mod_wsgi.so
# You need to manually edit this file to fit your needs.
# This configuration assumes the default installation prefix
# of /opt/graphite/, if you installed graphite somewhere else
@jayuloy
jayuloy / notes.md
Created January 25, 2016 16:14 — forked from DavidWittman/notes.md
A Brief Introduction to Fabric

A Brief Introduction to Fabric

Fabric is a deployment management framework written in Python which makes remotely managing multiple servers incredibly easy. If you've ever had to issue a change to a group servers, this should look pretty familiar:

for s in $(cat servers.txt); do ssh $s service httpd graceful; done

Fabric improves on this process by providing a suite of functions to run commands on the servers, as well as a number of other features which just aren't possible in a simple for loop. While a working knowledge of Python is helpful when using Fabric, it certainly isn't necessary. This tutorial will cover the steps necessary to get started with the framework and introduce how it can be used to improve on administering groups of servers.

@mhawksey
mhawksey / gist:7770536
Last active May 3, 2016 06:28
Google Apps Script code used in 'Keep your Twitter Archive fresh on Google Drive' http://mashe.hawksey.info/2013/01/sync-twitter-archive-with-google-drive/. To fix getContentAsString error open Tools > Script editor in your copy and replace the code with version below and test run the function updateArchive()
/*
Copyright 2013 Martin Hawksey
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
Unless required by applicable law or agreed to in writing, software
#!/bin/sh
#
# For each ref, validate the commit.
#
# - It disallows deleting branches without a /.
# - It disallows non fast-forward on branches without a /.
# - It disallows deleting tags without a /.
# - It disallows unannotated tags to be pushed.
@SalvaJ
SalvaJ / GoogleAPI.py
Last active June 7, 2016 13:47
Example making HTTP request to use Google API without api-client.It works in Python3 (tested ok in 3.3.5)
#!usr/bin/python3
# -*- coding: UTF-8 -*-
"""This module is a sample of the OAuth2 authentication by Python3"""
__version__ = "0.1.0"
__author__ = "shin (shin.hateblo.jp)"
__copyright__ = "(C) 2012 shin"
__email__ = "s2pch.luck@gmail.com"
__license__ = "Apache License 2.0"
@IanVaughan
IanVaughan / history
Created May 19, 2012 12:17
problems with mysql and sequel gem working in ruby
$ sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql 1 ↵ ✹ ✭master ‹1.9.3-p125›
Successfully installed mysql-2.8.1
$ sudo gem uninstall mysql ✹ ✭master ‹1.9.3-p125›
Successfully uninstalled mysql-2.8.1
$ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config ✹ ✭master ‹1.9.3-p125›
Fetching: mysql-2.8.1.gem (100%)
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
@alikhajeh1
alikhajeh1 / Gemfile
Created March 12, 2013 22:29
Rake task to convert a Postgres DB to a MySQL DB using the taps gem (https://github.com/ricardochimal/taps)
# Gems needed to convert a Postgres DB to MySQL
gem 'pg', '~> 0.14.0'
gem 'mysql2', '~> 0.3.11'
gem 'taps', '~> 0.3.24'
gem 'sqlite3', '~> 1.2'
@Sundrique
Sundrique / jupyter-notebook.conf
Last active August 15, 2016 12:32
Jupyter notebook Upstart config
description "Jupyter notebook"
start on runlevel [2345]
stop on runlevel [016]
chdir /home/ubuntu/notebooks
env PATH=/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin