Skip to content

Instantly share code, notes, and snippets.

View dashjim's full-sized avatar
💢

dashjim

💢
  • AWS
  • Shanghai China
View GitHub Profile
@dashjim
dashjim / gist:cf105cdc66f01810169faee05ee49bb9
Created December 17, 2020 10:04
Check the image and rotate it
def guess_direction(cut_points):
# bbs = np.asarray(cut_points)
bbs = cut_points
l = bbs[:, 2] - bbs[:, 0]
# Convert negative length to positive.
l = np.asarray([-i if i < 0 else i for i in l])
w = bbs[:, 3] - bbs[:, 1]
w = np.asarray([-i if i < 0 else i for i in w])
@dashjim
dashjim / keras_hist_ploy.py
Created February 5, 2020 06:01
plot Keras/tensorflow training history
import matplotlib as mpl
import matplotlib.pyplot as plt
model = make_model()
model.load_weights(initial_weights)
model.layers[-1].bias.assign([0.0])
zero_bias_history = model.fit(
train_features,
train_labels,
@dashjim
dashjim / zshrc config for kaggle docker to run properly
Last active May 26, 2018 11:36
zshrc config for kaggle docker to run properly
# Jim
1 kpython(){
2 docker run -v $PWD:/tmp/working -w=/tmp/working --rm -it kaggle/python python "$@"
3 }
4 ikpython() {
5 docker run -v $PWD:/tmp/working -w=/tmp/working --rm -it kaggle/python ipython
6 }
7 kjupyter() {
8 # (sleep 1 && open "http://$(docker-machine ip docker2):8888")&
9 docker run --network='host' -v $PWD:/tmp/working -w=/tmp/working --rm -it kaggle/python:latest jupyter notebook --no- browser --allow-root --notebook-dir=/tmp/working
@dashjim
dashjim / .vimrc
Created December 5, 2017 02:35
my vimrc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Maintainer:
" Amir Salihefendic
" http://amix.dk - amix@amix.dk
"
" Version:
" 6.0 - 01/04/17 14:24:34
"
" Blog_post:
" http://amix.dk/blog/post/19691#The-ultimate-Vim-configuration-on-Github
KEYBINDINGS
byobu keybindings can be user defined in /usr/share/byobu/keybindings/ (or within .screenrc if byobu-export was used). The common key bindings
are:
F2 - Create a new window
F3 - Move to previous window
F4 - Move to next window
@dashjim
dashjim / persistence.xml
Last active March 21, 2016 02:42 — forked from mortezaadi/persistence.xml
persistence xml configurations for major databases and jpa providers
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<!-- derby -->
@dashjim
dashjim / gist:b46232743402d436e826
Created October 9, 2015 04:00
Spring MVC redirect / to api doucment.
package springfoxdemo.boot.swagger.web;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class HomeController {
@RequestMapping("/")
public String home() {
return "redirect:swagger-ui.html";
@dashjim
dashjim / main.cpp
Last active June 9, 2021 11:23
WebRTC voe - voice engine - Playout local audio file demo - for Windows - passed for VS 2010
#include <iostream>
#include <locale>
#include <string>
#include "voe_base.h"
#include "voe_codec.h"
#include "voe_volume_control.h"
#include "voe_dtmf.h"
#include "voe_rtp_rtcp.h"
#include "voe_audio_processing.h"
if "%1"=="min" goto :begin
start /min "" %0 min
exit
:begin
call KillVTMC.bat
sleep.exe 2000
copy /y "C:\users\administrator\appdata\Roaming\avaya\Avaya one-X Communicator\config_bak.xml" "C:\users\administrator\appdata\Roaming\avaya\Avaya one-X Communicator\config.xml"
sleep.exe 2001
Start "avaya" "C:\Program Files\Avaya\Avaya one-X Communicator\onexcui.exe" "/m"
sleep.exe 120000
taskkill /im onexcengine.exe /f
taskkill /im onexcui.exe /f
sleep.exe 2000
taskkill /im StarteCAT.exe /f
taskkill /im eCAT.exe /f
taskkill /im eCATConfig.exe /f
taskkill /im eCATKeeper.exe /f
taskkill /im Grg* /f
taskkill /im TwinScreen.exe /f