Skip to content

Instantly share code, notes, and snippets.

View igorbrigadir's full-sized avatar

Igor Brigadir igorbrigadir

View GitHub Profile
@igorbrigadir
igorbrigadir / jack_1170853995981737984.json
Created October 31, 2019 09:43
Twitter Face Recognition API Entities
{
"created_at": "Mon Sep 09 00:18:40 +0000 2019",
"id": 1170853995981737984,
"id_str": "1170853995981737984",
"full_text": "Met PM @jacindaardern at the Beehive today for a followup discussion on the Christchurch call. Also my first time in New Zealand. Kind folks and beautiful environment. https://t.co/XQWdPrHrf4",
"truncated": false,
"display_text_range": [
0,
167
],
@igorbrigadir
igorbrigadir / 1191481292464017408.json
Created November 5, 2019 17:58
New Labs Format Tweet: Detailed, All Expansions
{
"data": {
"id": "1191481292464017408",
"created_at": "2019-11-04T22:24:11.000Z",
"text": "rereading T.S. Eliot's Macavity: The Mystery Cat for various TTRPG reasons and I've always appreciated the incredible escalation between these two verses https://t.co/UQos8xAkRb",
"author_id": "21946225",
"attachments": {
"media_keys": [
"3_1191481277880385536"
]

Twitter still trending in middle age says biographer

"We really needed to understand how this might transform culture and public communication," says social media expert Jean Burgess from QUT. Pic: Sarah Marshall

@igorbrigadir
igorbrigadir / _search_comparison.py
Last active December 31, 2019 15:52
Compare Twitter Premium and Standard Search
"""
Compare Standard Search and Premium Search.
(Retweets and replies are included, not using paid premium here so this operator is unavailable.)
Rule length exceeds the max allowable. The max is 256, both were edited to match.
Dates for standard are set in query, dates for premium in parameters. 2019-12-05 to 2019-12-10
"""
RESTAPI_QUERY = '(place:4ec01c9dbc693497) ("bear cub" OR "brown bear" OR "black bear") (-"bear and peacock" -"golden bear" -"metz bear home" -baseball -bearandpeacock -championship -chicago -coach -fans -golden -halftime -hockey -homerun -inning -nfl -polar -team -teddy) (since:2019-12-05 until:2019-12-10)'
@igorbrigadir
igorbrigadir / download.md
Created December 17, 2019 12:54
Google Drive Download with wget

File ID: https://drive.google.com/file/d/1UibyVC_C2hoT_XEw15gPEwPW4yFyJFeOEA/view?usp=sharing

1UibyVC_C2hoT_XEw15gPEwPW4yFyJFeOEA

< 100 MB "Small File"

wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O FILENAME

> 100 MB "Large File"

@igorbrigadir
igorbrigadir / 01_load.html
Last active December 14, 2022 17:02
Pre-Load Tweet Embed HTML
<html>
<body>
<div id="tweet-463440424141459456">
<!-- This is from publish.twitter.com / oembed API call https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-oembed -->
<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Sunsets don&#39;t get much better than this one over <a href="https://twitter.com/GrandTetonNPS?ref_src=twsrc%5Etfw">@GrandTetonNPS</a>. <a href="https://twitter.com/hashtag/nature?src=hash&amp;ref_src=twsrc%5Etfw">#nature</a> <a href="https://twitter.com/hashtag/sunset?src=hash&amp;ref_src=twsrc%5Etfw">#sunset</a> <a href="http://t.co/YuKy2rcjyU">pic.twitter.com/YuKy2rcjyU</a></p>&mdash; US Department of the Interior (@Interior) <a href="https://twitter.com/Interior/status/463440424141459456?ref_src=twsrc%5Etfw">May 5, 2014</a></blockquote>
</div>
<!--
... more tweets here - in a div to make them easy to extract later.
@igorbrigadir
igorbrigadir / no-trim-print.sh
Created February 18, 2020 11:30
Printing Booklet Papers with pdfbook
#!/bin/bash
# Parse file name (can sometimes break with strange names but works with most)
FILE="$(basename $1 .pdf)"
# Bookletize
pdfbook $FILE".pdf"
# Launch pdf viewer of your choice to preview and print
evince $FILE"-book.pdf"
# Remove temporarily created files after veiwer is closed
rm $FILE"-book.pdf"
@igorbrigadir
igorbrigadir / pandas_multiprocess.ipynb
Created February 24, 2020 11:48
Resumable, Multiprocessing apply for Pandas Dataframes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@igorbrigadir
igorbrigadir / cuda_docker_dev.md
Last active July 30, 2020 14:13
Working with Notebooks on GPUs with CUDA

Working with Notebooks on GPUs with CUDA

Like a lot of people, i prototype things in notebooks. When it comes to working with GPUs, a common problem i've had to deal with over and over is keeping my environment in delicate balance.

A Stable arrangement I ended up using:

@igorbrigadir
igorbrigadir / BookmarkAPI_en.md
Created August 3, 2020 12:46 — forked from stepney141/BookmarkAPI_en.md
WIP: Twitter Undocumented Endpoints for Bookmark

Twitter Undocumented Bookmark API (WIP)

I found out the endpoints for bookmark with Chrome Developer Tools: GET timeline/bookmark, POST bookmark/entries/remove, POST bookmark/entries/remove. The rate limits below are values returned by an official endpoint GET application/rate_limit_status.

This document is still a work in progress because I got stuck in GET timeline/bookmark. Please let me know if you find how to use it.

Notes

  • It is necessary that x-csrf-token in a request header and ct0 in a cookie are the same value. Twitter uses them to avoid CSRF attacks. I recommend that you extract the values from your browsers.
  • All of the endpoints requires OAuth2 Authorizations. Note that they refuse OAuth2 Bearer tokens obtained from POST oauth2/token.
  • You can easily reach the rate limit and get HTTP 429 Error (too many requests), so you should be careful about how many requests you send.