Skip to content

Instantly share code, notes, and snippets.

View BedirYilmaz's full-sized avatar
🤖
Building

Bedir Yılmaz BedirYilmaz

🤖
Building
View GitHub Profile
@pmutua
pmutua / How to Do a Clean Restart of a Docker Instance
Created August 3, 2020 13:42
How to Do a Clean Restart of a Docker Instance
How to Do a Clean Restart of a Docker Instance
If you are using Docker-Machine, make sure your are talking to the right one. Execute the command docker-machine ls to find which one is currently active. It is also recommended to always redo the command:
`eval "$(docker-machine env <docker machine name>)" `
Note: Deleting volumes will wipe out their data. Back up any data that you need before deleting a container.
Procedure
Stop the container(s) using the following command:
`docker-compose down`
Delete all containers using the following command:
`docker rm -f $(docker ps -a -q)`
Delete all volumes using the following command:
@colematt
colematt / byobu-cheatsheet.md
Last active May 8, 2024 12:48 — forked from devhero/byobu_cheatsheet
[Byobu cheatsheet] #byobu

Source: F9, Help - Quick Start Guide

Byobu is a suite of enhancements to tmux, as a command line
tool providing live system status, dynamic window management,
and some convenient keybindings:
@omry
omry / config.yaml
Created June 11, 2020 09:34
Hydra flask example
server:
host: 127.0.0.1
port: 8081
app:
username: ${env:USER}
flask:
ENV: production
DEBUG: false
@gagregrog
gagregrog / rtsp_stream.py
Last active April 10, 2024 04:02
View an RTSP stream in python with OpenCV
import cv2
import imutils
from imutils.video import VideoStream
# replace this with the url generated by the Wyze app
rtsp_url = "rtsp://<camera_name>:<some_uuid>@<some_ip>/live"
vs = VideoStream(rtsp_url).start()
while True:
@1f0
1f0 / cv2_streamiing.py
Last active April 27, 2023 06:14
cv2 rtmp streaming example
import numpy as np
import cv2
cap = cv2.VideoCapture('rtmp://localhost/live/stream')
while(True):
# Capture frame-by-frame
ret, frame = cap.read()
# Our operations on the frame come here
@krishvishal
krishvishal / plot_kernels.py
Last active October 22, 2022 18:27
Visualize weights in pytorch
from model import Net
from trainer import Trainer
import torch
from torch import nn
from matplotlib import pyplot as plt
model = Net()
ckpt = torch.load('path_to_checkpoint')
model.load_state_dict(ckpt['state_dict'])
filter = model.conv1.weight.data.numpy()
@jimfleming
jimfleming / colorize.py
Last active November 25, 2022 19:36
A utility function for TensorFlow that maps a grayscale image to a matplotlib colormap for use with TensorBoard image summaries.
import matplotlib
import matplotlib.cm
import tensorflow as tf
def colorize(value, vmin=None, vmax=None, cmap=None):
"""
A utility function for TensorFlow that maps a grayscale image to a matplotlib
colormap for use with TensorBoard image summaries.
@danielmahal
danielmahal / removeduplicateframes.sh
Created March 6, 2017 21:43
Remove duplicate frames from video with ffmpeg and mpdecimate
ffmpeg -i input.mov -vf mpdecimate,setpts=N/FRAME_RATE/TB output.mov
@nomanr
nomanr / CounterExampleActivity.java
Last active November 14, 2023 10:49
A simple Android class that can start continuous counter when pressed and hold on a view.
package noman.counterhelper;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
/**
* Created by Noman on 11/8/2016.
*/
@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