Skip to content

Instantly share code, notes, and snippets.

@QuadTriangle
QuadTriangle / goto.py
Created May 5, 2020 12:01 — forked from georgexsh/goto.py
python goto with system trace function
import sys
def j(lineno):
frame = sys._getframe().f_back
called_from = frame
def hook(frame, event, arg):
if event == 'line' and frame == called_from:
try:
frame.f_lineno = lineno
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
@QuadTriangle
QuadTriangle / domino.js
Created June 13, 2019 04:18 — forked from vectorsize/domino.js
D3 in a virtual DOM proof of concept.
!function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.domino=e():"undefined"!=typeof global?global.domino=e():"undefined"!=typeof self&&(self.domino=e())}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
var parserlib = require('./cssparser');
module.exports = CSSStyleDeclaration;
function CSSStyleDeclaration(elt) {
this._element = elt;
}
// Utility function for parsing style declarations
@QuadTriangle
QuadTriangle / ytdl_totalsize.py
Created May 24, 2019 15:02 — forked from theychx/ytdl_totalsize.py
Script that uses youtube-dl to calculate total size of all videos in a playlist (also works with single videos).
#! /usr/bin/env python3
import math
import sys
import youtube_dl
BEST_FORMAT = "bestvideo+bestaudio/best"
@QuadTriangle
QuadTriangle / ubuntu-select-mirror.list
Created April 2, 2019 15:41
auto select nearest mirror
deb mirror://mirrors.ubuntu.com/mirrors.txt bionic main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt bionic-updates main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt bionic-backports main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt bionic-security main restricted universe multiverse
@QuadTriangle
QuadTriangle / csv_to_arrow.py
Created December 4, 2018 07:14
csv to apache arrow file converter
import pandas as pd
import pyarrow as pa
df = pd.read_csv("data.csv")
table = pa.Table.from_pandas(df)
with open('out.arrow', 'bw') as f:
writer = pa.RecordBatchFileWriter(f, table.schema)
writer.write(table)
writer.close()
@QuadTriangle
QuadTriangle / frontendChoropleth.js
Created November 13, 2018 05:55 — forked from MarcBalaban/frontendChoropleth.js
Example of Frontend Choropleth with MapD Charting and us-states.json
<!DOCTYPE html>
<html lang="en">
<head>
<title>MapD</title>
<meta charset="UTF-8">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link href='https://fonts.googleapis.com/css?family=Roboto:400,700,300' rel='stylesheet' type='text/css'>
<style>
.title {
font-weight: bold;
@QuadTriangle
QuadTriangle / bot.py
Created October 2, 2018 13:24
A wikipedia bot for facebook messenger
import requests
from flask import Flask, request
from mediawiki import MediaWiki, DisambiguationError
from pymessenger.bot import Bot
ACCESS_TOKEN = 'SORRY, PUT YOUR ACCESS TOKEN HERE!'
app = Flask(__name__)
@QuadTriangle
QuadTriangle / data_pack_airtel.py
Last active December 22, 2017 06:03
Buy airtel (BD) data pack automatically
'''
A small python script to buy Airtel data pack with ease and convenience.
It uses Robi ecare API and SL4A (only tested on QPython v2.0.11).
SIM card must be attached on same device. If you want to run this
script on another device, please, use the version v4.
Use this script at your own _risk_.
author: Quad Triangle <t.me/QuadTriangle, fb.com/QuadTriangle>
year: 2017
license: Unlicense <http://unlicense.org/>