Skip to content

Instantly share code, notes, and snippets.

View install-java.sh
apt-add-repository ppa:webupd8team/java -y && apt-get update
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
apt-get install -y oracle-java8-installer
View ADDSUB8.vhd
library ieee;
use ieee.std_logic_1164.all;
entity ha is
port(
a,b: in std_logic;
s,c: out std_logic);
end ha;
architecture behv of ha is
begin
s<= a xor b;
View ALU.vhd
library ieee;
use ieee.std_logic_1164.all;
entity ALU is port(
s: in std_logic_vector(4 downto 0);
a,b : in std_logic_vector(7 downto 0);
F: out std_logic_vector(7 downto 0);
unsigned_overflow : inout std_logic;
signed_overflow : inout std_logic;
carry: out std_logic;
View crhasb.
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
export VISUAL="vim"
@hiorws
hiorws / play_all_voices.sh
Created Aug 7, 2016 — forked from ttscoff/play_all_voices.sh
A quick Bash loop to play all available voices for OS X say command
View play_all_voices.sh
#!/bin/bash
# Arguments can include a quoted string to define the test string to be repeated
# If an argument is numbers only, it changes the rate at which to speak (words per minute, default 200)
play_all_voices() {
local voice
local rate=200
local test_string="How are you?"
for arg in $@; do
if [[ $arg =~ ^[0-9]+$ ]]; then
@hiorws
hiorws / gist:50776cc72e8d884c8480fe42238e3070
Created Aug 10, 2016
Python AES two-way encryption/decryption example
View gist:50776cc72e8d884c8480fe42238e3070
from Crypto.Cipher import AES
import base64
import os
# the block size for the cipher object; must be 16, 24, or 32 for AES
BLOCK_SIZE = 32
# the character used for padding--with a block cipher such as AES, the value
# you encrypt must be a multiple of BLOCK_SIZE in length. This character is
# used to ensure that your value is always a multiple of BLOCK_SIZE
@hiorws
hiorws / gist:8d29051a9078a9f039eb01074b14228e
Created Aug 24, 2016 — forked from jordelver/gist:3139365
How to write an image file to an SD card under Mac OS X (for Raspberry Pi)
View gist:8d29051a9078a9f039eb01074b14228e

Find the SD card device

In this case, the SD card is /dev/disk4. DO NOT get this wrong or you may destroy all the data on the wrong disk/card/drive.

diskutil list

/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *160.0 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
@hiorws
hiorws / min-char-rnn.py
Created Sep 17, 2016 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
View min-char-rnn.py
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@hiorws
hiorws / 0_urllib2.py
Created Nov 9, 2016 — forked from kennethreitz/0_urllib2.py
urllib2 vs requests
View 0_urllib2.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
gh_url = 'https://api.github.com'
req = urllib2.Request(gh_url)
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm()
@hiorws
hiorws / sentiment_classification.py
Created Dec 15, 2016 — forked from bonzanini/sentiment_classification.py
Sentiment analysis with scikit-learn
View sentiment_classification.py
# You need to install scikit-learn:
# sudo pip install scikit-learn
#
# Dataset: Polarity dataset v2.0
# http://www.cs.cornell.edu/people/pabo/movie-review-data/
#
# Full discussion:
# https://marcobonzanini.wordpress.com/2015/01/19/sentiment-analysis-with-python-and-scikit-learn