Skip to content

Instantly share code, notes, and snippets.

@dswwsd
dswwsd / pip.conf
Last active August 9, 2022 06:18
国内源
[global]
trusted-host = mirrors.aliyun.com
index-url = https://mirrors.aliyun.com/pypi/simple
@dswwsd
dswwsd / mov2gif.sh
Last active August 9, 2022 06:17
mov to gif function
mov2gif () {
movie=$1
height=$(mdls -name kMDItemPixelHeight ${movie} | grep -o '[0-9]\+')
width=$(mdls -name kMDItemPixelWidth ${movie} | grep -o '[0-9]\+')
dimensions="${width}x${height}"
ffmpeg -i ${movie} -s ${dimensions} -pix_fmt rgb24 -r 10 -f gif ${movie}.gif
}
@dswwsd
dswwsd / generate-dropbear-key.sh
Last active August 9, 2022 03:44 — forked from hongkongkiwi/generate-dropbear-key
Generate SSH Key in Dropbear
#!/bin/bash
KEY_DIR="~/.ssh"
# Make directories
mkdir -p "$KEY_DIR"
# Generate an RSA key using dropbear
dropbearkey -t rsa -f "${KEY_DIR}/id_rsa"
@dswwsd
dswwsd / pi4_ssd1306.txt
Created April 8, 2020 07:35
pi4+ssd1306
spi
GND GND
VCC 3v3
D0 SCLK
D1 MOSI
RES reset/--gpio-reset
DC data command/--gpio-data-command
CS CE0
@dswwsd
dswwsd / distance.js
Last active December 14, 2017 06:23 — forked from clauswitt/distance.js
Get the distance between two (world) coordinates - a nodejs module
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* */
/* Simple node js module to get distance between two coordinates. */
/* */
/* Code transformed from Chris Veness example code - please refer to his website for licensing */
/* questions. */
/* */
/* */
/* Latitude/longitude spherical geodesy formulae & scripts (c) Chris Veness 2002-2011 */
/* - www.movable-type.co.uk/scripts/latlong.html */
Response response = context.response();
response.setHeader("Access-Control-Allow-Origin", "*");
//Handle preflight requests
if(context.request().method().equals("OPTIONS")) {
response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE");
response.setHeader("Access-Control-Max-Age", "3600");
response.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization, X-Auth-Token");
response.setHeader("Access-Control-Allow-Credentials", "true");