Skip to content

Instantly share code, notes, and snippets.

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
a,b: in std_logic;
s,c: out std_logic);
end ha;
architecture behv of ha is
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;;
export VISUAL="vim"
hiorws /
Created Aug 7, 2016 — forked from ttscoff/
A quick Bash loop to play all available voices for OS X say command
# 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 / 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
# 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 / 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

   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *160.0 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
hiorws /
Created Sep 17, 2016 — forked from karpathy/
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
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 /
Created Nov 9, 2016 — forked from kennethreitz/
urllib2 vs requests
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
gh_url = ''
req = urllib2.Request(gh_url)
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm()
hiorws /
Created Dec 15, 2016 — forked from bonzanini/
Sentiment analysis with scikit-learn
# You need to install scikit-learn:
# sudo pip install scikit-learn
# Dataset: Polarity dataset v2.0
# Full discussion: