Skip to content

Instantly share code, notes, and snippets.

@beeman
beeman / remove-all-from-docker.sh
Created November 15, 2016 03:04
Remove all from Docker
# Stop all containers
docker stop `docker ps -qa`
# Remove all containers
docker rm `docker ps -qa`
# Remove all images
docker rmi -f `docker images -qa `
# Remove all volumes
@jiewpeng
jiewpeng / add_anaconda_right_click_menu.md
Last active February 14, 2024 10:15
Add Anaconda Prompt to Windows right click context menu

This gist describes how to add Anaconda Prompt to the Windows right click context menu. This is because at some point, Anaconda no longer adds itself to the PATH after installation.

  1. Run regedit.exe
  2. Navigate to HKEY_CLASSES_ROOT > Directory > Background > shell
  3. Add a key named AnacondaPrompt and set its value to "Anaconda Prompt Here" (or anything you'd like it to appear as in the right click context menu)
  4. Add a key under this key, called command, and set its value to cmd.exe /K C:\Anaconda3\Scripts\activate.bat (may have to change the activate.bat file to whereever Anaconda is installed)
@obscurerichard
obscurerichard / README.md
Created September 17, 2012 22:35
Simulates a low bandwidth, high-latency network connection

slow

This bash script offers quick shortcuts to simulate slower network connections. It is useful when you need to simulate a wireless network on a Linux network server, especially when you are using a virtual machine guest on your local machine or in the cloud.

slow 3G                   # Slow network on default eth0 down to 3G wireless speeds
slow reset                # Reset connection for default eth0 to normal
slow vsat --latency=500ms # Simulate satellite internet  with a high latency
slow dsl -b 1mbps         # Simulate DSL with a slower speed than the default

slow modem-56k -d eth0 # Simulate a 56k modem on the eth1 device. eth0 is unchanged.

@ishu3101
ishu3101 / reset-wsl.sh
Created July 22, 2016 23:38
Resetting your Windows Subsystem for Linux (WSL) Environment
# Resetting your Windows Subsystem for Linux (WSL) Environment
lxrun.exe /uninstall /full
lxrun.exe /install
@nimaid
nimaid / install_conda.bat
Created May 14, 2020 18:18
Batch script to install Miniconda on WIndows without user input
@echo off
set ORIGDIR="%CD%"
set MINICONDAPATH=%USERPROFILE%\Miniconda3
set CONDAEXE=%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%-condainstall.exe
set "OS="
set "MCLINK="
where conda >nul 2>nul
@jmclong
jmclong / jupyter_notebook_config.py
Created August 26, 2021 19:03
Save a copy of a Jupyter notebook in a '.history' folder every time the notebook is saved
import os
import shutil
import pathlib
from datetime import datetime
def post_save(model, os_path, contents_manager):
"""post-save hook for saving backups of jupyter files."""
if model['type'] != 'notebook':
return # only do this for notebooks
directory, filename = os.path.split(os_path)
@Zulko
Zulko / graph_editor.py
Last active April 27, 2021 19:15
This function enables to manually draw a graph (nodes and edges) that can then be used in Python (with Networkx for instance)It's extremely simple: >>> nodes, edges, nodes_positions = graph_editor()
import matplotlib.pyplot as plt
import numpy as np
def graph_editor(grid=True, grid_N = 12):
"""
This function enables to draw a graph manually using
Matplotlib's interactive plotting capabilites.
In a first phase you are asked to place the nodes
(left-click to place a node, right-click to remove
/*
* Licensed to Peter Karich under one or more contributor license
* agreements. See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*
* Peter Karich licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the
* License at
*
@1kastner
1kastner / map matching with jupyter.ipynb
Last active January 4, 2019 14:20
map matching with jupyter
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vgoklani
vgoklani / Viterbi.py
Created October 14, 2011 17:51
Viterbi algorithm for Hidden Markov Models (HMM) taken from wikipedia
#!/usr/bin/python
# http://en.wikipedia.org/wiki/Viterbi_algorithm
'''
Consider two friends, Alice and Bob, who live far apart from each other and who talk together daily over the telephone about what they did that day. Bob is only interested in three activities: walking in the park, shopping, and cleaning his apartment. The choice of what to do is determined exclusively by the weather on a given day. Alice has no definite information about the weather where Bob lives, but she knows general trends. Based on what Bob tells her he did each day, Alice tries to guess what the weather must have been like.
Alice believes that the weather operates as a discrete Markov chain. There are two states, "Rainy" and "Sunny", but she cannot observe them directly, that is, they are hidden from her. On each day, there is a certain chance that Bob will perform one of the following activities, depending on the weather: "walk", "shop", or "clean". Since Bob tells Alice about his activities, those are the observations. The entire