Skip to content

Instantly share code, notes, and snippets.

@Kentzo
Kentzo / dlcourse.tf
Last active October 23, 2019 02:16
Set up AWS environment for dlcourse.ai using Terraform
# See https://www.terraform.io
# ---
# Variables
# ---
# Deep Learning AMI https://aws.amazon.com/marketplace/pp/B077GCH38C
variable "ami" {
default = "ami-0656a055aec8320d6"
}
@asanakoy
asanakoy / Scrape with proxy
Created October 12, 2018 19:11
How to scrape data fwom awebsite through proxies
#Proxy list graper
# https://github.com/abdallahelsokary/Proxy-Collector-/blob/master/Proxy_Collector.py
import urllib.request
import urllib.error
import time
def proxy_list():
try:
class MyCallBack(Callback):
def __init__(self, x_v, y_v):
super(MyCallBack, self).__init__()
self.x_v, self.y_v = x_v, y_v
self.ps = []
def on_epoch_end(self, epoch, logs={}):
p = self.model.predict(self.x_v).flatten()
self.ps.append(p)
logs['val_loss'] = log_loss(self.x_y, p)
@ruslangrimov
ruslangrimov / keras-tensorflow-model-profiling.py
Last active October 15, 2019 20:51
Profiling a Keras-TensorFlow model
import tensorflow as tf
from tensorflow.python.client import timeline
from keras import backend as K
run_options = tf.RunOptions(trace_level=tf.RunOptions.FULL_TRACE)
run_metadata = tf.RunMetadata()
model = ... # A Keras model
fn = K.function(model.inputs, model.outputs, options=run_options, run_metadata=run_metadata)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shagunsodhani
shagunsodhani / SkipThoughtVectors.md
Created December 3, 2016 09:36
Notes for Skip-Thought Vectors paper

Skip-Thought Vectors

Introduction

  • The paper describes an unsupervised approach to train a generic, distributed sentence encoder.
  • It also describes a vocabulary expansion method to encode words not seen at training time.
  • Link to the paper

Skip-Thoughts

@gdamjan
gdamjan / aiohttp-server.py
Last active October 2, 2021 15:29
Example: asyncio and aiohttp, handling longpoll, eventsource and websocket requests with a queue and background workers
from aiohttp import web
from threading import Thread
import asyncio
import time, uuid
loop = asyncio.get_event_loop()
def long_blocking_thing(sleep):
time.sleep(sleep)
return 42
@tuxfight3r
tuxfight3r / sftp-wrapper
Created April 22, 2015 15:01
SFTP Wrapper to Log User Sessions along with file transfer logs
!/bin/sh
#
# sftpd wrapper script for executing pre/post session actions
#
# pre session actions and logging here
SOURCE_IP=${SSH_CLIENT%% *}
MSG_SESSION_START="user $LOGNAME session start from $SOURCE_IP"
logger -p local5.notice -t sftpd-wrapper -i "$MSG_SESSION_START"
@strezh
strezh / GStreamer-1.0 some strings.sh
Last active October 16, 2024 13:31
GStreamer-1.0 personal cheat sheet
#!/bin/bash
# play YUV444 FULL HD file
gst-launch-1.0 -v filesrc location=size_1920x1080.yuv ! \
videoparse width=1920 height=1080 framerate=25/1 format=GST_VIDEO_FORMAT_Y444 ! \
videoconvert ! \
autovideosink
# play YUV422 FULL HD file
gst-launch-1.0 -v filesrc location=size_1920x1080.yuv ! \