Skip to content

Instantly share code, notes, and snippets.

View bxshi's full-sized avatar

Dash Shi bxshi

  • University of Notre Dame
  • South Bend, Indiana
View GitHub Profile
@wictorwilen
wictorwilen / azureiot.md
Last active October 19, 2022 19:21
Azure IoT integration for Home Assistant

layout: page title: "Azure IoT" description: "Offers support for Azure IoT integration with Homeassistant." date: 2017-10-22 14:18 sidebar: true comments: false sharing: true footer: true logo: home-assistant.png

@tokestermw
tokestermw / tf_dataset_api_text.py
Last active December 18, 2018 06:32
Using the new Dataset API from TensorFlow 1.2.0, return padded and batched tensors from text data where each line is a sentence.
import numpy as np
import tensorflow as tf
_major_version, _minor_version, _ = map(int, tf.__version__.split('-')[0].split('.'))
assert _major_version >= 1 and _minor_version >= 2, "requires TensorFlow 1.2.0 and above"
text_data_path = "./z_sentences.txt"
MAX_SEQUENCE_LENGTH = 10
@geoHeil
geoHeil / gist:3dff11860ae042792cea6970447c4592
Created April 16, 2016 14:22
Spark window function fails in SQL
import org.apache.spark.sql.{ Row, SQLContext }
import org.apache.spark.sql.expressions.Window
val sql = new org.apache.spark.sql.SQLContext(sc)
val dataset = Seq(
("Thin", "cell phone", 6000),
("Normal", "tablet", 1500),
("Mini", "tablet", 5500),
("Ultra thin", "cell phone", 5000),
("Very thin", "cell phone", 6000),
@sigmix
sigmix / tmux_local_install.sh
Last active April 19, 2017 14:42 — forked from ryin/tmux_local_install.sh
Script that installs tmux without need for root permission, modified to work on AFS (Andrew File System)
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# per https://www.opensource.apple.com/source/ncurses/ncurses-27/ncurses/INSTALL
# Script will check whether $HOME/local is under AFS, if so, ncurses shall be configured with --enable-symlinks
# exit on error
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active May 5, 2024 18:31
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@cosimo
cosimo / parse-options.sh
Created September 21, 2012 09:31
Example of how to parse options with bash/getopt
#!/bin/bash
#
# Example of how to parse short/long options with 'getopt'
#
OPTS=`getopt -o vhns: --long verbose,dry-run,help,stack-size: -n 'parse-options' -- "$@"`
if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi
echo "$OPTS"
@goctave
goctave / 1.c
Created April 16, 2012 03:10
CareerCup 1.1
/**************************************************
1.最简单的方法就是两层循环,复杂度O(n^2)
2.使用排序,然后找重复。复杂度为O(nlgn)+O(n)=O(nlgn)
3.直接使用快排,在排序过程中,如果发现有重复的,立即结束递归
****************************************************/
#include <stdio.h>
#include <string.h>
int repeat;