Skip to content

Instantly share code, notes, and snippets.

View cschar's full-sized avatar

cschar cschar

View GitHub Profile
@cschar
cschar / gist:e65e27527d7d015730d56df520ed272a
Created August 11, 2018 21:05
Test tensorflow on both cpu and gpu
import tensorflow as tf
with tf.device('/cpu:0'):
a_c = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a-cpu')
b_c = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b-cpu')
c_c = tf.matmul(a_c, b_c, name='c-cpu')
with tf.device('/gpu:0'):
a_g = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a-gpu')
b_g = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b-gpu')
@cschar
cschar / hn_seach.js
Last active October 3, 2017 17:20 — forked from kristopolous/hn_seach.js
hn job query search
// query(['remote', 'python'], ['visa','react'])
function query() {
var
// HN is done with very unsemantic classes.
job_list = Array.prototype.slice.call(document.querySelectorAll('.c5a,.cae,.c00,.c9c,.cdd,.c73,.c88')),
query_list = Array.prototype.slice.call(arguments),
shown = 0, total = job_list.length;
// Traverses up the dom stack trying to find a match of a specific class
@cschar
cschar / requests-oauth2.py
Created August 11, 2017 21:31 — forked from ymotongpoo/requests-oauth2.py
Google API OAuth 2.0 Authorization Sample in Python
# -*- coding: utf-8 -*-
"""
This scripts reqire a third party module 'requests'.
You can get it from PyPI, i.e. you can install it using
easy_install or pip.
http://docs.python-requests.org/en/v0.10.4/
Original source code is written by shin1ogawa, which is in Java.
@cschar
cschar / requests-oauth2.py
Created August 11, 2017 21:31 — forked from ymotongpoo/requests-oauth2.py
Google API OAuth 2.0 Authorization Sample in Python
# -*- coding: utf-8 -*-
"""
This scripts reqire a third party module 'requests'.
You can get it from PyPI, i.e. you can install it using
easy_install or pip.
http://docs.python-requests.org/en/v0.10.4/
Original source code is written by shin1ogawa, which is in Java.
# sudo apt-get install:
# - php5
# - php5-cli
# - php5-curl
# - php5-gd
# - php5-imagick
# - php5-mysql
# - php5-xmlrpc
# - php5-xdebug
# - php5-fpm
#!/bin/bash
gdbus monitor -e -d com.canonical.Unity -o /com/canonical/Unity/Session | ts >> ~/lock_unlocks.txt &
@cschar
cschar / etrigg-split-ui-prototype.js
Last active March 19, 2016 13:59
Prototype to show a split view possibility in etrigg.com, allowing easy viewing of each event without switching browser tabs
//1. Search for events in a certain location on etrigg.com
//2. Paste into console in developer window then execute
//3. Click on each event for the info to show up on the right side of screen
var eventContainer = jQuery('.container')[1];
jQuery(eventContainer).css('min-width', '330px');
jQuery(eventContainer).css('max-width', '50%');
jQuery(eventContainer).css('float', 'left');
$('.footer').remove();
@cschar
cschar / tmux.conf
Last active August 29, 2015 14:25 — forked from spicycode/tmux.conf
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@cschar
cschar / gist:36f73f302b64b92504e3
Created November 7, 2014 21:58
kill processes
ps | grep app.py | cut -c1-5 | xargs kill