Skip to content

Instantly share code, notes, and snippets.

View stoensin's full-sized avatar
🎯
Focusing

Joe Stone stoensin

🎯
Focusing
  • shenzhen university
  • shenzhen
View GitHub Profile
@briangonzalez
briangonzalez / README.md
Created October 21, 2012 04:25
img2boxshadow - a ruby script to convert images to CSS [http://codepen.io/briangonzalez/details/AvrGI#pen-details-tab]

img2boxshadow.rb

a ruby script to convert images to CSS (box-shadows)

Installation

gem install rmagick    # you'll need ImageMagick & Ruby first
gem install colormath
gem install micro-optparse
@zedshaw
zedshaw / gist:4e14bbca46eb21aad08d
Created June 18, 2015 04:44
If you ever need to build apache APR on OSX Yosemite, just touch it a whole bunch.
set -e
# go somewhere safe
cd /tmp
# get the source to base APR 1.5.2
curl -L -O http://archive.apache.org/dist/apr/apr-1.5.2.tar.gz
# extract it and go into the source
tar -xzvf apr-1.5.2.tar.gz
@liuliqiang
liuliqiang / client.py
Last active January 10, 2020 03:15
celery-demo
#!/usr/bin/env python
# encoding: utf-8
from worker import add
# add.apply_async((1, ), priority=1)
# add.apply_async((1, ), priority=1)
add.apply_async((7, ), priority=7)
add.apply_async((6, ), priority=6)
add.apply_async((5, ), priority=5)
add.apply_async((8, ), priority=8)
@xunkai55
xunkai55 / setup_bpy.sh
Last active March 16, 2022 00:39
Setup bpy (Blender as a python module) on Mac OS X
# Do not excute the script directly. It is just for demonstration.
# If you followed the documentation and got the errors below, please take a look at this guide.
# Color management: using fallback mode for management
# bpy: couldnt find 'scripts/modules', blender probably wont start.
# Freestyle: couldn't find 'scripts/freestyle/modules', Freestyle won't work properly.
# ImportError: No module named 'bpy_types'
# ImportError: No module named 'bpy_types'
# pyrna_srna_ExternalType: failed to find 'bpy_types' module
# ImportError: No module named 'bpy_types'
@mieitza
mieitza / mongo_to_csv.py
Created January 3, 2018 15:09 — forked from wixb50/mongo_to_csv.py
python mongo to csv use pandas.
# @Author: xiewenqian <int>
# @Date: 2016-11-28T20:35:09+08:00
# @Email: wixb50@gmail.com
# @Last modified by: int
# @Last modified time: 2016-12-01T19:32:48+08:00
import pandas as pd
from pymongo import MongoClient
@dslwind
dslwind / 邪门歪道之用OpenCV精准切割视频
Last active April 9, 2024 09:24
使用OpenCV、Python以及FFmpeg逐帧处理视频
# 邪魔歪道之使用OpenCV精准切割视频
## ffmpeg 切割视频
使用ffmpeg直接切割视频的命令
```
ffmpeg -i test.mp4 -ss 00:00:00 -t 00:00:30 -c:v copy -c:a copy output.mp4
```
或者
```
@v0y4g3r
v0y4g3r / notify.sh
Last active February 19, 2019 11:10
bark-bash
#! /bin/bash
in=$1
if [ -z "$in" ]
then
in=$(cat -)
fi
if [ -z "$in" ]
@tomericco
tomericco / cosine_similarity.js
Created January 26, 2019 10:58
Cosine similarity implementation in JS
const str1 = 'This is an example to test cosine similarity between two strings';
const str2 = 'This example is testing cosine similatiry for given two strings';
//
// Preprocess strings and combine words to a unique collection
//
const str1Words = str1.trim().split(' ').map(omitPunctuations).map(toLowercase);
const str2Words = str2.trim().split(' ').map(omitPunctuations).map(toLowercase);
const allWordsUnique = Array.from(new Set(str1Words.concat(str2Words)));
@stoensin
stoensin / ops
Created February 28, 2019 15:07
import tensorflow as tf
import numpy as np
##################################################################################
# Initialization
##################################################################################
# Xavier : tf.contrib.layers.xavier_initializer()
# He : tf.contrib.layers.variance_scaling_initializer()
# Normal : tf.random_normal_initializer(mean=0.0, stddev=0.02)
@stoensin
stoensin / all
Last active May 5, 2019 15:23
冒泡、选择、插入、希尔、归并、计数、快排
class ALG(object):
def __init__(self,list):
self.list=list
#冒泡
def bubble_sort(nums):
n =len(nums)
for i in range(n - 1):
for j in range(n-1 - i):
if nums[j+1] < nums[j]:
nums[j], nums[j + 1] = nums[j + 1], nums[j]