Skip to content

Instantly share code, notes, and snippets.

View gaiar's full-sized avatar

Gaiar Baimuratov gaiar

View GitHub Profile
@gaiar
gaiar / pycon-views.py
Last active August 26, 2015 11:37 — forked from miguelgrinberg/pycon-views.py
Generate statistics about PyCon 2014 videos
import argparse
import re
from multiprocessing.pool import ThreadPool as Pool
import requests
import bs4
root_url = 'http://pyvideo.org'
index_url = root_url + '/category/50/pycon-us-2014'
@gaiar
gaiar / main.py
Last active September 9, 2015 07:14 — forked from leandrotoledo/main.py
Webhook using self-signed certificate and Flask (with python-telegram-bot library)
#!/usr/bin/env python
'''Using Webhook and self-signed certificate'''
# This file is an annotated example of a webhook based bot for
# telegram. It does not do anything useful, other than provide a quick
# template for whipping up a testbot. Basically, fill in the CONFIG
# section and run it.
# Dependencies (use pip to install them):
# - python-telegram-bot: https://github.com/leandrotoledo/python-telegram-bot
@gaiar
gaiar / tmux-cheatsheet.markdown
Created June 26, 2017 06:08 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
/**
* @param $app
* @return int:
* -4: Error
* -3: Googlebot
* -2: Found locally, not a VPN
* -1: Looked up, not a VPN
* 1: Looked up, VPN
* 2: Found locally, VPN
*/
@gaiar
gaiar / App Store
Created November 16, 2017 11:16 — forked from mattcassinelli/App Store
Action list to open the App Store, search for a term, and open the Top Paid, Free, or Grossing charts.
http://[[list:App Store|Open=appstore.com/|Search=search.itunes.apple.com/WebObjects/MZSearch.woa/wa/search?media=software&term=[prompt:Query]|Top Paid=itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewTop?genreId=36&popId=30|Top Free=itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewTop?genreId=36&popId=27|Top Grossing=itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewTop?genreId=36&popId=38]]
http://
[[
list:App Store
|Open=appstore.com/
|Search=search.itunes.apple.com/WebObjects/MZSearch.woa/wa/search?media=software&term=[prompt:Query]
|Top Paid=itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewTop?genreId=36&popId=30
|Top Free=itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewTop?genreId=36&popId=27
|Top Grossing=itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewTop?genreId=36&popId=38
@gaiar
gaiar / travis_to_conda.md
Created May 14, 2018 12:16 — forked from zshaheen/travis_to_conda.md
How to Setup Automatic Uploads to Anaconda from Travis CI in 15 minutes

How to Setup Automatic Uploads to Anaconda from Travis CI in 15 minutes

TL;DR: Edit .travis.yaml to install Anaconda and to run conda_upload.sh after testing. Edit meta.yaml to take in the environmental variables $VERSION and $CONDA_BLD_PATH. Create conda_upload.sh which sets the needed environmental variables, builds the tar archive, and uploads it to Anaconda. Finally edit some stuff on your Anaconda and Travis CI account so they can talk.

Intro

The following steps will detail how to automatically trigger Anaconda builds and uploads from Travis CI. This will only upload successful builds in the master branch and if there are multiple commits in a single day, it'll only keep the latest one. Both of these settings can easily be changed.

Edit .travis.yaml

First, edit .travis.yml so that it installs Anaconda.

install:
@gaiar
gaiar / pytorch-on-raspberry-pi3.md
Created May 23, 2018 08:54 — forked from fgolemo/pytorch-on-raspberry-pi3.md
How to install PyTorch v0.3.1 on RaspberryPi 3B - Tutorial

How to install PyTorch v0.3.1 on RaspberryPi 3B

Prerequisites

Important I'd recommend you use at least a 16GB sd card. I tried it with an 8GB card and it baaaaarely fits. I had to uninstall a lot of packages and regularly clean up.

Go to https://www.raspberrypi.org/downloads/raspbian/ and download the Raspbian Stretch image (either one).

Use Etcher (from https://etcher.io/) to "burn" the image onto the SD card.

@gaiar
gaiar / DS NN guidelines
Created June 6, 2018 12:03 — forked from snakers4/DS NN guidelines
Complete system installation for Data Science / Neural Networks from scratch / bare metal (assuming you have assembled the PC)
# BASIC SYSTEM SETUP
# First donwload Ubuntu iso file from https://www.ubuntu.com/download/desktop
# Use 16.04 LTS (17 is also ok, but it's better to use LTS versions, also 18 will be very mature in terms of systemd)
# Dowload Linux live USB creator and install the iso to your USB stick https://www.linuxliveusb.com
# Boot your system, go to BIOS on boot (usually Del) or boot menu (usually F12) and choose your USB stick as boot medium
# Install Linux (these steps can be omitted if clean Ubuntu installation is provided as service by admins / cloud provider / etc)
# Minor trick unplug ALL of your hard disks (unless you are an avanced user) except for the disk for your system
@gaiar
gaiar / Dockerfile
Created July 3, 2018 08:12 — forked from snakers4/Dockerfile
My PyTorch 0.4 Dockerfile
# add 7z tar and zip archivers
FROM nvidia/cuda:9.0-cudnn7-devel
# https://docs.docker.com/engine/examples/running_ssh_service/
RUN apt-get update && apt-get install -y openssh-server
RUN mkdir /var/run/sshd
RUN echo 'root:Ubuntu@41' | chpasswd
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config
RUN mkdir ~/.ssh/
@gaiar
gaiar / 01.README.md
Created July 23, 2018 14:07 — forked from matsukaz/01.README.md
Find a geolocation of an IP address in BigQuery

This query is to find geolocation of an IP address including latitude, longitude, city and country.

Legacy SQL doesn't support range conditions such as BETWEEN when using JOIN, so we need to filter data by WHERE. This means if IP address does not match any of the data inside geolite_city_bq_b2b, records will not be able to receive.

Use Standard SQL if you want to receive records no matter you succeed to find geolocation or not.

Please refer to the following post for more detail.

https://cloudplatform.googleblog.com/2014/03/geoip-geolocation-with-google-bigquery.html