Skip to content

Instantly share code, notes, and snippets.

cschar cschar

Block or report user

Report or block cschar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@cschar
cschar / gist:e65e27527d7d015730d56df520ed272a
Created Aug 11, 2018
Test tensorflow on both cpu and gpu
View gist:e65e27527d7d015730d56df520ed272a
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 Oct 3, 2017 — forked from kristopolous/hn_seach.js
hn job query search
View hn_seach.js
// 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 Aug 11, 2017 — forked from ymotongpoo/requests-oauth2.py
Google API OAuth 2.0 Authorization Sample in Python
View requests-oauth2.py
# -*- 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 Aug 11, 2017 — forked from ymotongpoo/requests-oauth2.py
Google API OAuth 2.0 Authorization Sample in Python
View requests-oauth2.py
# -*- 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.
View php nginx conf for wordpress
# sudo apt-get install:
# - php5
# - php5-cli
# - php5-curl
# - php5-gd
# - php5-imagick
# - php5-mysql
# - php5-xmlrpc
# - php5-xdebug
# - php5-fpm
View monitor locks and unlocks in ubuntu
#!/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 Mar 19, 2016
Prototype to show a split view possibility in etrigg.com, allowing easy viewing of each event without switching browser tabs
View etrigg-split-ui-prototype.js
//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();
View 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
View gist:36f73f302b64b92504e3
ps | grep app.py | cut -c1-5 | xargs kill
You can’t perform that action at this time.