Skip to content

Instantly share code, notes, and snippets.

@parsa
parsa / 0_reuse_code.js
Created November 4, 2016 17:28
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@parsa
parsa / README.rst
Created December 21, 2016 00:37 — forked from tonyseek/README.rst
Build Python binding of C++ library with cffi (PyPy/Py3K compatible)

Run with Python:

pip-2.7 install cffi
PYTHON=python2.7 sh go.sh

Run with PyPy:

pip-pypy install cffi
PYTHON=pypy sh go.sh
@parsa
parsa / web-servers.md
Created December 27, 2016 16:33 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@parsa
parsa / 0_urllib2.py
Last active January 25, 2017 19:41 — forked from kennethreitz/0_urllib2.py
urllib2 vs requests
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
from base64 import b64encode
request = urllib2.Request('https://api.github.com/user')
request.add_header('Authorization', 'Basic ' + b64encode('user' + ':' + 'pass'))
r = urllib2.urlopen(request)
@parsa
parsa / irc.md
Last active April 25, 2017 14:29 — forked from xero/irc.md
irc cheat sheet

IRC Reference

The Basics

  • /join #channel
  • Joins the specified channel.
  • /part #channel
  • Leaves the specified channel.
@parsa
parsa / fib_test.cpp
Last active February 7, 2018 20:36 — forked from shahrzad/fib_test
// Copyright (c) 2018 Shahrzad Shirzad
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <phylanx/phylanx.hpp>
#include <hpx/hpx_main.hpp>
#include <iostream>
@parsa
parsa / drake-gdb.py
Created March 4, 2018 21:26 — forked from ytomino/drake-gdb.py
My first gdb pretty-printer
# from pprint import pprint
import codecs
import unicodedata
def get_typename(val):
t = gdb.types.get_basic_type(val.type).tag
if not t: t = val.type.name
return t
def is_graphic(c):
@parsa
parsa / .dockerignore
Last active February 2, 2019 03:03 — forked from taless474/build-py2-silo.bat
Dockerfile for pyublas - Moved to https://github.com/parsa/octoviz
*.bat
*.ipynb
@parsa
parsa / embedded-file-viewer.md
Last active March 12, 2019 21:10 — forked from tzmartin/embedded-file-viewer.md
Embedded File Viewer: Google Drive, OneDrive

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

OneDrive Embed Links

@parsa
parsa / hpx_reverse.cpp
Created June 10, 2020 02:46 — forked from BillyONeal/hpx_reverse.cpp
HPX reverse comparative
#include <hpx/hpx.hpp>
#include <hpx/hpx_init.hpp>
#include <hpx/parallel/algorithms/reverse.hpp>
#include <algorithm>
#include <execution>
#include <functional>
#include <random>
#include <vector>
#include "stopwatch.hpp"