Skip to content

Instantly share code, notes, and snippets.

View snake_active_contour.py
from skimage import io, filters, draw, color
import numpy as np
# A Fast algorithm for active contours and curvature estimation
# https://www.cs.princeton.edu/courses/archive/spr02/cs496/williams_shah.pdf
def main():
# ループの終了条件
max_iter = 10000
thresh_finish = 10.0
View focal_loss_pytroch.py
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
from torch.autograd import Function
import numpy as np
def one_hot(index, classes):
size = index.size() + (classes,)
View memory_leak_pytorch.py
import torch
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms
import time
from sklearn import datasets
import numpy
from PIL import Image
class ImageDataSet(Dataset):
"""Image dataset."""
View keras-vis-stanford40action.py
import os
import glob
import numpy as np
import keras
from keras.callbacks import ModelCheckpoint
from keras.preprocessing import image
from keras.preprocessing.image import ImageDataGenerator
from keras.layers import Input
from vis.visualization import visualize_cam, overlay
View monitor_smtp_delay_by_pop.py
# -*- coding: utf-8 -*-
import email
import poplib
import time
import smtplib
import sys
import traceback
# ------目的---------------------
# このスクリプトはメール配送にかかっている時間を測定する。
# Zabbix等と組み合わせてメールの遅延状況を監視するために使うことを想定している。
View progress.sh
# spinner characters
# http://stackoverflow.com/questions/2685435/cooler-ascii-spinners
# spinner code
# https://github.com/IntellexApps/blcheck.git
# Define spinner
#SPINNER="-\|/"
#SPINNER=".oO@*"
#SPINNER="▉▊▋▌▍▎▏▎▍▌▋▊▉"
View pdns-geobackend-multiples.patch
diff --git a/modules/geobackend/geobackend.cc b/modules/geobackend/geobackend.cc
index 287db2f..9f9ef35 100644
--- a/modules/geobackend/geobackend.cc
+++ b/modules/geobackend/geobackend.cc
@@ -25,20 +25,13 @@ using boost::trim_right;
// Static members
-IPPrefTree * GeoBackend::ipt;
-vector<string> GeoBackend::nsRecords;
View quicksort_bubblesort.py
#-*- coding:utf-8
def main():
a=[102, 3, 15, 1, 11, 5, -1, 4, 5]
print "start %s" % (a)
b = bubble_sort(a)
q = quick_sort(a)
print "bubble %s" % (b)
print "quick %s" % (q)
View pdns_thread_tuning.sh
THREADS=300
ULIMITS=4096
DOMAIN=your.domain
function dig(){
for i in $(seq $THREADS); do
dig @localhost $DOMAIN &
done
wait
View sftpserver.sh
$ easy_install sftpserver
# create ssh_key
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/sci01436/.ssh/id_rsa): ./test_rsa.key
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in ./test_rsa.key.
Your public key has been saved in ./test_rsa.key.pub.
You can’t perform that action at this time.