This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from keras.models import Sequential | |
from keras.layers import LSTM, Dense | |
import numpy as np | |
def gen_sig(num_samples, seq_len): | |
one_indices = np.random.choice(a=num_samples, size=num_samples // 2, replace=False) | |
x_val = np.zeros((num_samples, seq_len), dtype=np.bool) | |
x_val[one_indices, 0] = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# dropbox service | |
# Replace with linux users you want to run Dropbox clients for | |
DROPBOX_USERS="user1 user2" | |
DAEMON=.dropbox-dist/dropbox | |
start() { | |
echo "Starting dropbox..." | |
for dbuser in $DROPBOX_USERS; do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Copyright (c) 2012 Yu-Jie Lin | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy of | |
# this software and associated documentation files (the "Software"), to deal in | |
# the Software without restriction, including without limitation the rights to | |
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | |
# of the Software, and to permit persons to whom the Software is furnished to do | |
# so, subject to the following conditions: | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# diffs the contents of yaml files semantically. that is, ydiff will parse each | |
# yaml file and then diff their resulting trees, instead of attempting to diff | |
# the text. it's specifically for comparing directories of translations from | |
# Crowdin, so it's effectively only concerned with strings. | |
require 'pathname' | |
require 'rubygems' | |
require 'yaml' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
''' Generates database schema graph from a relational database. | |
Usages: | |
Add database configuation in this file and then | |
python app.py | |
Note: You must have your latest database schema in the database | |
engine you are running against. | |
''' | |
from __future__ import unicode_literals, absolute_import |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "async-ui" | |
version = "0.1.0" | |
authors = ["Dmitry Kalyanov <Kalyanov.Dmitry@gmail.com>"] | |
edition = "2018" | |
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
[dependencies] | |
futures = "0.3.4" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker rmi $(docker images -q -f dangling=true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from BeautifulSoup import BeautifulSoup | |
def _remove_attrs(soup): | |
for tag in soup.findAll(True): | |
tag.attrs = None | |
return soup | |
def example(): | |
doc = '<html><head><title>test</title></head><body id="foo" onload="whatever"><p class="whatever">junk</p><div style="background: yellow;" id="foo" class="blah">blah</div></body></html>' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
try: | |
# for python newer than 2.7 | |
from collections import OrderedDict | |
except ImportError: | |
# use backport from pypi | |
from ordereddict import OrderedDict | |
import yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Two things are wrong with Django's default `SECRET_KEY` system: | |
1. It is not random but pseudo-random | |
2. It saves and displays the SECRET_KEY in `settings.py` | |
This snippet | |
1. uses `SystemRandom()` instead to generate a random key | |
2. saves a local `secret.txt` |
OlderNewer