Skip to content

Instantly share code, notes, and snippets.

View igorbrigadir's full-sized avatar

Igor Brigadir igorbrigadir

View GitHub Profile
@braingineer
braingineer / fnc.ipynb
Created February 1, 2017 19:29 — forked from anonymous/fnc.ipynb
FNC1 - Data Handling Resources
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
anonymous
anonymous / fnc.ipynb
Created February 1, 2017 19:29
FNC1 - Data Handling Resources
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jeroenjanssens
jeroenjanssens / jq.md
Last active June 8, 2018 08:37
Some jq examples translated from https://github.com/jsonlines/guide
@obskyr
obskyr / stream_response.py
Last active January 1, 2025 14:46
How to stream a requests response as a file-like object.
# -*- coding: utf-8 -*-
import requests
from io import BytesIO, SEEK_SET, SEEK_END
class ResponseStream(object):
def __init__(self, request_iterator):
self._bytes = BytesIO()
self._iterator = request_iterator
@joernhees
joernhees / dbpedia.jsonl
Created November 19, 2016 22:04
DBpedia JSON Extractor
{"comment": "Kaiserslautern ([\u02ccka\u026az\u0250s\u02c8la\u028at\u0250n]) is a city in southwest Germany, located in the Bundesland (State) of Rhineland-Palatinate (Rheinland-Pfalz) at the edge of the Palatinate Forest (Pf\u00e4lzerwald). The historic centre dates to the 9th century. It is 459 kilometres (285 miles) from Paris, 117 km (73 miles) from Frankfurt am Main, and 159 km (99 miles) from Luxembourg.", "pic": "http://commons.wikimedia.org/wiki/Special:FilePath/Kaiserslautern-Stadtwappen.svg", "uri": "http://dbpedia.org/resource/Kaiserslautern", "label": "Kaiserslautern", "areaTotal": "1.3972e+08", "types": ["http://www.w3.org/2002/07/owl#Thing", "http://www.wikidata.org/entity/Q3957", "http://www.wikidata.org/entity/Q486972", "http://dbpedia.org/ontology/PopulatedPlace", "http://dbpedia.org/ontology/Settlement", "http://dbpedia.org/ontology/Town", "http://www.w3.org/2003/01/geo/wgs84_pos#SpatialThing", "http://schema.org/Place", "http://dbpedia.org/ontology/Place", "http://dbpedia.org/ontology/Locat
@robotcator
robotcator / download_text8.py
Last active June 25, 2020 13:10
a script downloads the text8.zip corpus.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import six
import os
if six.PY3:
from urllib.request import urlopen
else:
from urllib2 import urlopen
@joelgrus
joelgrus / counting.py
Last active November 27, 2016 16:46
choose your collections wisely
"""
how to count as fast as possible
(numbers from Python 3.5.2 on a Macbook Pro)
YMMV, but these results are pretty stable for me, say +/- 0.1s on repeated runs
"""
from collections import Counter, defaultdict
import random
random_numbers = [random.randrange(10000) for _ in range(10000000)]
@psychemedia
psychemedia / natural_language_time_periods.py
Last active October 10, 2022 07:13
Simple python functions to give dates and date ranges in "natural time"; this week, next month, etc.
import datetime
from dateutil.relativedelta import relativedelta
def today(date=None,iso=False):
if date is None: date=datetime.date.today()
if iso: return date.isoformat()
else: return date
def yesterday(date=None,iso=False):
if date is None: date=today()
@tdhopper
tdhopper / tweets.sh
Created August 5, 2016 12:40
Find your tweets from this date in earlier years.
# Find your tweets from this date in earlier years.
# OS X's date function doesn't have the required date math capabilities.
# This requires GNU date. You can get it on OS X with `brew install coreutils`
GDATE=/usr/local/bin/gdate
USERNAME=realDonaldTrump
export URL="https://twitter.com/search?q=from%3A$USERNAME%20("
for yearsago in {1..12}; do
@ipbastola
ipbastola / clean-up-boot-partition-ubuntu.md
Last active October 22, 2025 09:55
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r