Skip to content

Instantly share code, notes, and snippets.

View vincentclaes's full-sized avatar
:octocat:

Vincent Claes vincentclaes

:octocat:
View GitHub Profile
@mariussoutier
mariussoutier / Mail.scala
Created August 23, 2012 12:13
Sending mails fluently in Scala
package object mail {
implicit def stringToSeq(single: String): Seq[String] = Seq(single)
implicit def liftToOption[T](t: T): Option[T] = Some(t)
sealed abstract class MailType
case object Plain extends MailType
case object Rich extends MailType
case object MultiPart extends MailType
@sloria
sloria / bobp-python.md
Last active July 7, 2024 18:13
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@svschannak
svschannak / rgb-cmyk-rgb-conversion
Created February 4, 2014 10:10
convert rgb to cmyk to rgb
def rgb_to_cmyk(r,g,b):
cmyk_scale = 100
if (r == 0) and (g == 0) and (b == 0):
# black
return 0, 0, 0, cmyk_scale
# rgb [0,255] -> cmy [0,1]
c = 1 - r / 255.
sepal.length sepal.width petal.length petal.width variety
5.1 3.5 1.4 .2 Setosa
4.9 3 1.4 .2 Setosa
4.7 3.2 1.3 .2 Setosa
4.6 3.1 1.5 .2 Setosa
5 3.6 1.4 .2 Setosa
5.4 3.9 1.7 .4 Setosa
4.6 3.4 1.4 .3 Setosa
5 3.4 1.5 .2 Setosa
4.4 2.9 1.4 .2 Setosa
@mitchwongho
mitchwongho / Docker
Last active June 26, 2024 07:28
Docker 'run' command to start an interactive BaSH session
# Assuming an Ubuntu Docker image
$ docker run -it <image> /bin/bash
@cristovaov
cristovaov / fetch-followers.py
Created March 4, 2016 10:46
Silly tweepy / python script to get names and followers count on the Twitter
import tweepy
# Keys, tokens and secrets
consumer_key = ""
consumer_secret = ""
access_token = ""
access_token_secret = ""
# Tweepy OAuthHandler
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
@hbro
hbro / ImmowebScraper.py
Last active June 8, 2021 17:33
Scrape an Immoweb search URL and e-mail any new results.
#!/usr/bin/python3
# Usage:
# - Fill in the settings, then run with `python3 ImmowebScraper.py`.
# - First run won't send any mails (or you'd get dozens at once).
# Requirements:
# - python3
# - selenium
# - phantomjs
import sqlite3
@MOOOWOOO
MOOOWOOO / py-gitignore
Last active June 13, 2024 21:55
python pycharm gitignore
# Created by .ignore support plugin (hsz.mobi)
### Python template
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
@thomas-a-neil
thomas-a-neil / test_s3_download.py
Created August 22, 2016 20:59
Sample DAG to download from S3, sleep, and reupload
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from airflow.operators.python_operator import PythonOperator
from datetime import datetime, timedelta
# default arguments for each task
default_args = {
'owner': 'nthomas',
@bookshelfdave
bookshelfdave / reader.py
Created May 4, 2017 19:02
sample Python code using SQS
import boto3
sqs = boto3.client('sqs', region_name="us-west-2",
aws_access_key_id='',
aws_secret_access_key=''
)
queue_url = ''
response = sqs.receive_message(