Skip to content

Instantly share code, notes, and snippets.

Rust > C++ > Go > TypeScript > C

Samuel Marks SamuelMarks

Rust > C++ > Go > TypeScript > C
View GitHub Profile
SamuelMarks /
Created Oct 5, 2012
Python makes scraping easy!
from bs4 import BeautifulSoup as bs
import urllib3
def scrape_industries(site=''):
http = urllib3.PoolManager()
r = http.request('GET', site)
if r.status != 200:
return False
View gist:4404704
{{if response.flash:}}
<header style="padding-top: 35px">
{{if 'errors' in response.flash:}}
<div class="alert alert-block alert-error fade in">
<button type="button" class="close" data-dismiss="alert">
def uuid4():
"""Generate a random UUID."""
# When the system provides a version-4 UUID generator, use it.
if _uuid_generate_random:
_buffer = ctypes.create_string_buffer(16)
return UUID(bytes=_buffer.raw)
# Otherwise, get randomness from urandom or the 'random' module.
SamuelMarks /
Last active Dec 18, 2015
Python script to help me keep track of how much of the university material I have gotten through up until exams
import win32com.client # If I can be bothered, will switch to using an Open Source cross-platform API
from glob import glob
from PyPDF2 import PdfFileReader
from os import getcwd
from datetime import datetime
def pdf_page_count(filename):
curr = open(filename, "rb")
SamuelMarks / nodejs_phantomjs_render.js
Created Jul 26, 2013
Google AngularJS SEO talk from July, 2013
View nodejs_phantomjs_render.js
/* render website with JS and return its rendered output
Syntax: node nodejs_phantomjs_render.js [url] [output {default=stdout}] */
var system = require('system'),
fs = require('fs'),
page = new WebPage(),
url = system.args[1],
output = system.args[2],
SamuelMarks / Added-support-for-the-BSDs-and-Solaris-endianness.patch
Created Nov 8, 2013
Endianness checks replacement for LLVM (posted to llvm-commits)
View Added-support-for-the-BSDs-and-Solaris-endianness.patch
From 346740535fe71b34218fa1137a14e6ed8f6833ae Mon Sep 17 00:00:00 2001
From: Samuel Marks <>
Date: Fri, 8 Nov 2013 22:04:06 +1100
Subject: [PATCH] Added support for the BSDs and Solaris endianness; code from
ChromiumOS project (LevelDB ppl)
include/llvm/Support/Host.h | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
View gist:7602557
\author{Samuel Marks}
SamuelMarks /
Last active Nov 3, 2018
Simple algorithm to download all the videos in highest-quality from YouTube.
Simple algorithm to download all the videos in highest-quality from YouTube.
Run from the directory you want the videos to appear. Renames them so that they have the video number + omit the repetitive " - AngularJS -" text.
Installing dependency:
$ pip install git+
from pytube import YouTube #, exceptions as YTD_exceptions
View pyman
#!/usr/bin/env python
from sys import argv, exit
if __name__ == '__main__':
if len(argv) < 2:
print "USAGE: {0} MODULE [SYMBOL]".format(argv[0])
print "Open help() for given module, or given symbol from module"
from json import dumps, loads
from uuid import uuid4
from collections import OrderedDict
from klein import Klein
from exceptions import BaseException
class UniqueKeyError(BaseException):
You can’t perform that action at this time.