Skip to content

Instantly share code, notes, and snippets.

View DmitryBe's full-sized avatar

Dmitry B DmitryBe

View GitHub Profile
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active July 17, 2024 14:20
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@hSATAC
hSATAC / gist:5343225
Created April 9, 2013 05:38
Http Redirect in Golang
package main
import (
"log"
"net/http"
)
func redirect(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "http://www.google.com", 301)
@Mortimerp9
Mortimerp9 / Retry.scala
Last active July 3, 2022 22:35
A retry implementation for Scala, a bit of explanations here: http://pierreandrews.net/posts/retry-fail-scala.html
import scala.concurrent.Await
import scala.concurrent.ExecutionContext
import scala.concurrent.Future
import scala.concurrent.blocking
import scala.concurrent.duration.Deadline
import scala.concurrent.duration.Duration
import scala.concurrent.duration.DurationInt
import scala.concurrent.duration.DurationLong
import scala.concurrent.future
import scala.concurrent.promise
@heatxsink
heatxsink / glog-example.go
Last active March 25, 2023 06:02
An example of how to use golang/glog.
/*
glog-example
------------
background
---
You probably want to read the source code comments at the top of the glog.go file in
the golang/glog repository on github.com. Located here: https://github.com/golang/glog/blob/master/glog.go
setup
@fancellu
fancellu / MergeSort.scala
Created November 25, 2015 12:12
MergeSort in Scala with recursive merge
object MergeSort {
// recursive merge of 2 sorted lists
def merge(left: List[Int], right: List[Int]): List[Int] =
(left, right) match {
case(left, Nil) => left
case(Nil, right) => right
case(leftHead :: leftTail, rightHead :: rightTail) =>
if (leftHead < rightHead) leftHead::merge(leftTail, right)
else rightHead :: merge(left, rightTail)
@alexislucena
alexislucena / install-scala-sbt-and-java-on-ubuntu.md
Created December 5, 2016 12:35
Ubuntu: Install Scala, SBT and Java on Ubuntu 16.04

Install Scala 2.11.8

$ sudo apt-get remove scala-library scala
$ sudo wget www.scala-lang.org/files/archive/scala-2.11.8.deb
$ sudo dpkg -i scala-2.11.8.deb

Check Scala version

$ scala -version
@ruzickap
ruzickap / aws_create_site.yml
Created February 16, 2017 12:35
Ansible playbook which creates instances and tag volumes
---
- name: Create Instance in AWS
hosts: localhost
connection: local
gather_facts: false
vars:
aws_access_key: "xxxxxx"
aws_secret_key: "xxxxxx"
security_token: "xxxxxx"
@jubel-han
jubel-han / pipeline_venv_workarounds.groovy
Created April 13, 2017 08:14
Jenkins pipeline python virtualenv workarounds
node {
stage 'Checkout and Build'
createVirtualEnv 'env'
executeIn 'env', 'pip install -r requirements.txt'
executeIn 'env', './manage.py test'
executeIn 'env', './manage.py integration-test'
virtualEnv('true')
runCmd('pip install -r requirements.txt')
@EvenOldridge
EvenOldridge / ExportKerasToTensorflowServing.py
Last active January 11, 2019 21:42
Export a Keras Model for Tensorflow Serving
import numpy as np
import tensorflow as tf
import keras as k
from keras.applications.resnet50 import ResNet50
from keras import backend as K
from keras.layers.core import Flatten, Dense, Dropout, Lambda
from keras.models import Model
from keras.preprocessing import image
@zparnold
zparnold / one_liner.sh
Last active June 25, 2024 07:12
A simply script to delete all failed pods from Kubernetes
kubectl get pods --all-namespaces | grep Evicted | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod