Skip to content

Instantly share code, notes, and snippets.

View kingspp's full-sized avatar
🎯
Focusing

Prathyush SP kingspp

🎯
Focusing
View GitHub Profile
@rondefreitas
rondefreitas / DBENV.user.js
Last active December 14, 2023 21:05
Databricks Environment Banner User Script
// ==UserScript==
// @name Databricks Environment Banner
// @source https://gist.githubusercontent.com/rondefreitas/05ae8c35bac3e429ec9624255fd88a2f
// @namespace https://gist.githubusercontent.com/rondefreitas/05ae8c35bac3e429ec9624255fd88a2f
// @updateURL https://gist.githubusercontent.com/rondefreitas/05ae8c35bac3e429ec9624255fd88a2f/raw/DBENV.user.js
// @downloadURL https://gist.githubusercontent.com/rondefreitas/05ae8c35bac3e429ec9624255fd88a2f/raw/DBENV.user.js
// @supportURL https://gist.githubusercontent.com/rondefreitas/05ae8c35bac3e429ec9624255fd88a2f#new_comment_field
// @version 0.50
// @description Display Colored Banners for Databricks AWS Workspaces based on Subdomain
// @author Ron DeFreitas
@himaprasoonpt
himaprasoonpt / block_system_import.py
Last active September 12, 2021 00:30
Block os import and any other system import in python
from contextlib import contextmanager
@contextmanager
def block_system_import():
block_import = ["os",'sys']
saved = {}
import sys
for i in block_import:
saved[i] = sys.modules[i]
sys.modules[i] = None
yield None
@Wavefarer42
Wavefarer42 / docker-compose.yml
Created January 22, 2019 10:04
MongoDB Charts (docker-compose)
version: "3.3"
services:
mongo:
image: mongo:4.1.1
restart: on-failure
command: --wiredTigerCacheSizeGB 3
ports:
# Charts db is available under port 27018 to not block the default mongo port
- "8082:8081"
@omoindrot
omoindrot / tensorflow_finetune.py
Last active February 25, 2024 15:00
Example TensorFlow script for fine-tuning a VGG model (uses tf.contrib.data)
"""
Example TensorFlow script for finetuning a VGG model on your own data.
Uses tf.contrib.data module which is in release v1.2
Based on PyTorch example from Justin Johnson
(https://gist.github.com/jcjohnson/6e41e8512c17eae5da50aebef3378a4c)
Required packages: tensorflow (v1.2)
Download the weights trained on ImageNet for VGG:
```
wget http://download.tensorflow.org/models/vgg_16_2016_08_28.tar.gz
@karpathy
karpathy / pg-pong.py
Created May 30, 2016 22:50
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """
import numpy as np
import cPickle as pickle
import gym
# hyperparameters
H = 200 # number of hidden layer neurons
batch_size = 10 # every how many episodes to do a param update?
learning_rate = 1e-4
gamma = 0.99 # discount factor for reward
@simonw
simonw / gist:68d19a46e8edc2cd8c68
Last active October 13, 2021 00:04
Fix "Do you want the application "python" to accept incoming network connections?" by code signing the python executable in your virtualenv - copied here in case https://www.darklaunch.com/2014/02/02/fix-do-you-want-the-application-python-to-accept-incoming-network-connections ever goes away.
With the OS X firewall enabled, you can remove the "Do you want the application "python" to accept incoming network connections?" message.
Create a self-signed certificate.
Open Keychain Access. Applications > Utilities > Keychain Access.
Keychain Access menu > Certificate Assistant > Create a Certificate...
Enter a Name like "My Certificate".
Select Identity Type: Self Signed Root
Select Certificate Type: Code Signing
Check the Let me override defaults box
@learncodeacademy
learncodeacademy / webpack.config.js
Created January 8, 2016 03:55
Sample Basic Webpack Config
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
module.exports = {
context: __dirname,
devtool: debug ? "inline-sourcemap" : null,
entry: "./js/scripts.js",
output: {
path: __dirname + "/js",
filename: "scripts.min.js"
@claymcleod
claymcleod / pycurses.py
Last active April 6, 2024 23:53
Python curses example
import sys,os
import curses
def draw_menu(stdscr):
k = 0
cursor_x = 0
cursor_y = 0
# Clear and refresh the screen for a blank canvas
stdscr.clear()
@m00nlight
m00nlight / gist:d72f3913bab79e8e6e75
Created February 6, 2015 13:51
Python multiple consumer and producer problem
from Queue import Queue
from threading import Thread
from random import randrange
queue = Queue(10)
class Consumer(Thread):
def __init__(self, queue):
Thread.__init__(self)
self.queue = queue
@ericremoreynolds
ericremoreynolds / client.html
Last active February 25, 2024 21:55
Flask-socket.io emit to specific clients
<html>
<body>
<h1>I feel lonely</h1>
<script type="text/javascript" src="//code.jquery.com/jquery-2.1.3.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/socket.io/0.9.16/socket.io.min.js"></script>
<script type="text/javascript" charset="utf-8">
var socket = io.connect('http://' + document.domain + ':' + location.port);
socket.on('connect', function() {
socket.emit('connected');