Skip to content

Instantly share code, notes, and snippets.

View widnyana's full-sized avatar
🤘
I'm looking for new challenges :)

wid widnyana

🤘
I'm looking for new challenges :)
View GitHub Profile
#!/usr/bin/env python
"""
Regex for URIs
These regex are directly derived from the collected ABNF in RFC3986
(except for DIGIT, ALPHA and HEXDIG, defined by RFC2234).
They should be processed with re.VERBOSE.
"""
"""
Celery base task aimed at longish-running jobs that return a result.
``AwesomeResultTask`` adds thundering herd avoidance, result caching, progress
reporting, error fallback and JSON encoding of results.
"""
from __future__ import division
import logging
import simplejson
@widnyana
widnyana / pipelines.py
Last active November 23, 2015 06:57 — forked from tzermias/pipelines.py
Scrapy MySQL pipeline.Just a mirror to the asynchronous MySQL pipeline.Copy-paste it directly to pipelines.py. Database credentials are stored in settings.py. Based on http://snipplr.com/view/66986/
import MySQLdb.cursors
from twisted.enterprise import adbapi
from scrapy.xlib.pydispatch import dispatcher
from scrapy import signals
from scrapy.utils.project import get_project_settings
from scrapy import log
SETTINGS = get_project_settings()
@widnyana
widnyana / imdb_next_page_spider.py
Created January 6, 2016 07:23 — forked from premit/imdb_next_page_spider.py
Scrapy reference: Crawling next pagination
'''
Spider for IMDb
- Retrieve most popular movies & TV series with rating of 8.0 and above
- Crawl next pages recursively
'''
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.selector import Selector
@widnyana
widnyana / .golang-example-gitlab-ci.yml
Created October 10, 2016 09:48 — forked from mikeatlas/.golang-example-gitlab-ci.yml
Example Go GitLab CI setup (no root/sudo required)
# See docs/examples
# http://doc.gitlab.com/ce/ci/quick_start/README.html
# http://doc.gitlab.com/ce/ci/yaml/README.html
# GitLab CI template for Go tests. Note this installs
# a new working copy of Go in a non-standard path such
# that sudo/root is not needed for the install stage.
# note that this particular install-environment stage
# is overly verbose in order to debug anything tricky
@widnyana
widnyana / gist:fda560fe943f187b7d2dee30473bb5d6
Created January 30, 2017 15:56 — forked from zxvdr/gist:5624054
RPC tracing for Golang (ala Dapper)
diff --git a/client.go b/client.go
index 4b0c9c3..8ac98e4 100644
--- a/client.go
+++ b/client.go
@@ -32,6 +32,7 @@ type Call struct {
Reply interface{} // The reply from the function (*struct).
Error error // After completion, the error status.
Done chan *Call // Strobes when call is complete.
+ Trace uint32 // unique id used for tracing
}
@widnyana
widnyana / Documentation.md
Created March 17, 2017 13:51 — forked from KartikTalwar/Documentation.md
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@widnyana
widnyana / sgdbot.py
Created August 16, 2017 19:51 — forked from dkgeorge/sgdbot.py
Stop loss/Start gain dialog interactive bot for goxtool Mt.Gox trading bot framework
"""
a simple stop loss/start gain bot
adjust STOP_PRICE/START_PRICE and STOP_VOLUME/START_VOLUME to your needs.
to reset orders during runtime, press (s) for a new stop order and (g) for a new start gain
The file can be reloaded after editing without restarting goxtool by simply pressing the (l) key.
"""
# Using the global statement
# pylint: disable=W0603
# No exception type(s) specified
# pylint: disable=W0702
@widnyana
widnyana / install-comodo-ssl-cert-for-nginx.rst
Created August 28, 2018 00:40 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert