Skip to content

Instantly share code, notes, and snippets.

View bagvendt's full-sized avatar

Marcus Gregersen bagvendt

View GitHub Profile

Keybase proof

I hereby claim:

  • I am bagvendt on github.
  • I am bagvendt (https://keybase.io/bagvendt) on keybase.
  • I have a public key ASDfBT1b45NDWptXSNuyjhxUQivMmqUmtkXL6eYxbH-h_wo

To claim this, I am signing this object:

@bagvendt
bagvendt / rick astley
Created March 17, 2014 21:39
Never gonna give you up
from bs4 import BeautifulSoup as soup
import requests
rick_luv = "We're no strangers to love You know the rules and so do I A full commitment's what I'm thinking of You wouldn't get this from any other guy I just wanna tell you how I'm feeling Gotta make you understand, Never gonna give you up, Never gonna let you down Never gonna run around and desert you Never gonna make you cry, Never gonna say goodbye Never gonna tell a lie and hurt you"
rick_luv = rick_luv.replace("'", "")
rick_luv = rick_luv.replace(",", "")
create_url_get = "http://192.237.216.119/users/create"
create_url_post = "http://192.237.216.119/users/store"
@bagvendt
bagvendt / gist:7144563
Created October 24, 2013 20:37
Top 2 rated movies for actor_id = ?
SELECT actor_id, first_name, last_name, name FROM actors
JOIN `roles`
ON actors.`id` = roles.`actor_id`
JOIN `movies`
ON movies.`id` = `movie_id`
WHERE rank IS NOT NULL AND actor_id = %s
ORDER BY rank DESC
limit 2;
@bagvendt
bagvendt / gist:7144538
Created October 24, 2013 20:35
Find every actor that has appeared in at least 20 rated movies.
SELECT * FROM (
SELECT actor_id, COUNT(*) as count FROM actors
JOIN `roles`
ON actors.`id` = roles.`actor_id`
JOIN `movies`
ON movies.`id` = `movie_id`
WHERE rank IS NOT NULL
GROUP BY actor_id) a
WHERE a.count >= 20;