Skip to content

Instantly share code, notes, and snippets.

View igorbrigadir's full-sized avatar

Igor Brigadir igorbrigadir

View GitHub Profile
@evanmiltenburg
evanmiltenburg / excel_dropdown_test.py
Created June 17, 2019 10:14
Generate an Excel worksheet to provide word-level annotations
import xlsxwriter
# Create workbook with a new worksheet.
workbook = xlsxwriter.Workbook('hello.xlsx')
worksheet = workbook.add_worksheet()
# Write the tokens.
worksheet.write('A1', 'Hello')
worksheet.write('B1', 'world')
worksheet.write('C1', '!')
@thomwolf
thomwolf / gpt-2-wikitext-103.py
Last active October 25, 2025 13:45
A very small and self-contained gist to train a GPT-2 transformer model on wikitext-103
# Copyright (c) 2019-present, Thomas Wolf.
# All rights reserved. This source code is licensed under the MIT-style license.
""" A very small and self-contained gist to train a GPT-2 transformer model on wikitext-103 """
import os
from collections import namedtuple
from tqdm import tqdm
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from ignite.engine import Engine, Events
#!/usr/bin/env python
import sys, os, time
import tweepy
keys = dict(
consumer_key='_YOUR_CONSUMER_KEY',
consumer_secret='_YOUR_SECRET_KEY',
access_token='_YOUR_ACCESS_TOKEN',
access_token_secret='_YOUR_ACCESS_TOKEN_SECRET'
)
@cavedave
cavedave / eton.r
Last active July 23, 2019 19:46
Graph of the lifespans of the prime ministers of the uk since 1721This is inspired by this graph [US Presidential Lifespans & Terms](https://www.reddit.com/r/dataisbeautiful/comments/8lrzgc/us_presidential_lifespans_terms_oc) Data from wikipedia [List of Prime Ministers of the United Kingdom](https://en.wikipedia.org/wiki/List_of_Prime_Ministers…
cols <- c("Conservative" = "#0087DC", "Labour" = "#DC241f", "Liberal" = "#ffd700", "Whig" = "#FF7F00","Peelite"="#99FF99","Tory"="#b2b2ff","In Office"="black")
mydate <- as.Date("1900-01-01", "%Y-%m-%d")
explain <- as.Date("1864-01-01", "%Y-%m-%d")
Walpole <- as.Date("1676-04-01", "%Y-%m-%d")
bute <- as.Date("1713-01-01", "%Y-%m-%d")
Grenville <- as.Date("1712-10-14", "%Y-%m-%d")
Elder <-as.Date("1708-11-15", "%Y-%m-%d")
North <-as.Date("1732-04-13", "%Y-%m-%d")
@ivan
ivan / grab-anchor-episode.sh
Last active May 16, 2024 22:16
Download a podcast episode from anchor.fm
#!/usr/bin/env bash
# Download a podcast episode from anchor.fm
#
# Usage:
# grab-anchor-episode "https://anchor.fm/emerge/episodes/Robert-MacNaughton---Learnings-from-the-Life-and-Death-of-the-Integral-Center-e31val" # (m4a example)
# grab-anchor-episode "https://anchor.fm/free-chapel/episodes/Are-You-Still-In-Love-With-Praise--Pastor-Jentezen-Franklin-e19u4i8" # (mp3 example)
#
# anchor.fm serves a list of m4a or mp3 files that need to be concatenated with ffmpeg.
#
/**
* Implementation of [SSLSocketFactory] that adds [TlsVersion.TLS_1_2] as an enabled protocol for every [SSLSocket]
* created by [delegate].
*
* [See this discussion for more details.](https://github.com/square/okhttp/issues/2372#issuecomment-244807676)
*
* @see SSLSocket
* @see SSLSocketFactory
*/
class Tls12SocketFactory(private val delegate: SSLSocketFactory) : SSLSocketFactory() {
@MLWave
MLWave / tsne-transform.py
Created July 4, 2017 08:17
Embed test points in existing t-sne map
# Author: HJ van Veen <[email protected]>
# Description: Experiment to learn a tSNE transformer for new
# test data with a multi-output GBM
#
# Idea first seen at lvdmaaten.github.io/tsne
# > [...] it is not possible to embed test points in an existing
# > map [...]
# > A potential approach to deal with this would be to train
# > a multivariate regressor to predict the map location from
# > the input data.
@jcipriano
jcipriano / media-upload.py
Last active September 2, 2025 13:53
Async Twitter media upload example script in python. Generates media ID for use with Tweets and DMs.
import os
import sys
import time
import json
import requests
from requests_oauthlib import OAuth1
MEDIA_ENDPOINT_URL = 'https://upload.twitter.com/1.1/media/upload.json'
@vmarkovtsev
vmarkovtsev / notebook.ipynb
Created March 10, 2017 10:40
lapjv blog post
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mmarquezs
mmarquezs / index.patch
Created March 9, 2017 07:02
Infinite Jukebox Downloader
--- index.html 2017-03-08 20:16:55.078748101 +0100
+++ index_modified.html 2017-03-08 20:17:07.752111989 +0100
@@ -1,12 +1,12 @@
<!doctype html>
<html lang="en">
<head>
-<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
-<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script>
+<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
+<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script>