Skip to content

Instantly share code, notes, and snippets.

@guoxiangke
guoxiangke / led_music.py
Created February 21, 2024 17:42
PIR sensor with raspberrypi
import pygame
import random
from gpiozero import MotionSensor, LED
from signal import pause
pir = MotionSensor(4)
led = LED(17)
import glob
@guoxiangke
guoxiangke / gist:acdb1a2378e2731e98fad2a28e83bf31
Created May 12, 2018 12:12
sublime text 3170 license key
ZYNGA INC.
50 User License
EA7E-811825
927BA117 84C9300F 4A0CCBC4 34A56B44
985E4562 59F2B63B CCCFF92F 0E646B83
0FD6487D 1507AE29 9CC4F9F5 0A6F32E3
0343D868 C18E2CD5 27641A71 25475648
309705B3 E468DDC4 1B766A18 7952D28C
E627DDBA 960A2153 69A2D98A C87C0607
45DC6049 8C04EC29 D18DFA40 442C680B
@guoxiangke
guoxiangke / .htaccess
Created February 5, 2018 04:11
Exclude one url from Apache .htaccess password protected site
AuthType Basic
AuthName "Authentication Required"
AuthUserFile /etc/htpasswd/.htpasswd
# Allow access to excluded diretories
SetEnvIf Request_URI /contact-us/ noauth=1
SetEnvIf Request_URI /*.css noauth=1
SetEnvIf Request_URI /*.js noauth=1
SetEnvIf Request_URI /*.ico noauth=1
SetEnvIf Request_URI /*.png noauth=1
SetEnvIf Request_URI /*.jpg noauth=1
<?php
define ("SERIAL_DEVICE_NOTSET", 0);
define ("SERIAL_DEVICE_SET", 1);
define ("SERIAL_DEVICE_OPENED", 2);
/**
* Serial port control class
*
* THIS PROGRAM COMES WITH ABSOLUTELY NO WARANTIES !
* USE IT AT YOUR OWN RISKS !
var Promise = require('es6-promise').Promise;
var gulp = require('gulp');
var livereload = require('gulp-livereload')
var uglify = require('gulp-uglifyjs');
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var sourcemaps = require('gulp-sourcemaps');
var imagemin = require('gulp-imagemin');
var pngquant = require('imagemin-pngquant');
// http://blog.andrewray.me/how-to-copy-only-changed-files-with-gulp/
@guoxiangke
guoxiangke / drupal8-make-start
Created July 28, 2016 04:32
drupal8 start project makefile
DRUPAL_VERSION ?= 8.1.7
default: build
build: build-drupal
#chown -R $(WWW_USER):$(WWW_GROUP) ./build
# when any changes in backend ,do build-drupal
build-drupal:
cp -rf ./backend/modules ./public_html/
$account = user_load(12);
$weObj = _mp_service_init_wechat($account);
// $weObj->valid();
set_time_limit(0);
$qr = DRUPAL_ROOT.'/sites/default/files/QR/01/QR_1409.jpg';
// $qr = $file_path.'QR_'.$account->uid.'.jpg';
$data= array('media'=>$qr);//'@'.
$return = $weObj->uploadForeverMedia($data,'image');//
/\:\:)=<img class="wechat-emoji" src="/img/emoji/wechat/100.gif" alt="微笑" width="24">
/\:\:~=<img class="wechat-emoji" src="/img/emoji/wechat/101.gif" alt="伤心">
/\:\:B=<img class="wechat-emoji" src="/img/emoji/wechat/102.gif" alt="美女">
/\:\:|=<img class="wechat-emoji" src="/img/emoji/wechat/103.gif" alt="发呆">
/\:8-)=<img class="wechat-emoji" src="/img/emoji/wechat/104.gif" alt="墨镜">
/\:\:<=<img class="wechat-emoji" src="/img/emoji/wechat/105.gif" alt="哭">
/\:\:$=<img class="wechat-emoji" src="/img/emoji/wechat/106.gif" alt="羞">
/\:\:X=<img class="wechat-emoji" src="/img/emoji/wechat/107.gif" alt="哑">
/\:\:Z=<img class="wechat-emoji" src="/img/emoji/wechat/108.gif" alt="睡">
/\:\:'(=<img class="wechat-emoji" src="/img/emoji/wechat/109.gif" alt="哭">
<?php
// echo phpinfo();
// Set the content-type
// header('Content-Type: image/png');
header ("Content-type: image/png");
$x = 600;
$y = 1240;
// $x = 240;
@guoxiangke
guoxiangke / README.md
Created December 21, 2015 10:15 — forked from jimothyGator/README.md
Nginx configuration for Mac OS X with Homebrew, using sites-enabled directory.
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}

File locations:

  • nginx.conf to /usr/local/etc/nginx/
  • default and default-ssl to /usr/local/etc/nginx/sites-available
  • homebrew.mxcl.nginx.plist to /Library/LaunchDaemons/