Skip to content

Instantly share code, notes, and snippets.

@mikespook
mikespook / NTP.ino
Last active May 29, 2021 16:40
Sync ESP8266 board date/time with NTP
#include <time.h>
#include <TZ.h>
#include <ESP8266WiFi.h>
#include <StackThunk.h>
#include <WiFiClientSecure.h>
#include <ESP8266HTTPClient.h>
WiFiClientSecure client;
static const char digicert[] = "-----BEGIN CERTIFICATE-----\n"
"MIIHQDCCBiigAwIBAgIQD9B43Ujxor1NDyupa2A4/jANBgkqhkiG9w0BAQsFADBN\n"
@mikespook
mikespook / civicrm_8.x-master.patch
Created December 23, 2016 08:51
CiviCRM for Drupal 8 patch
diff --git a/civicrm.install b/civicrm.install
index a6bbc99..2531b4c 100644
--- a/civicrm.install
+++ b/civicrm.install
@@ -60,6 +60,7 @@ function civicrm_install() {
* @param $phase
*/
function civicrm_requirements($phase) {
+# require_once DRUPAL_ROOT . "/modules/libraries/libraries.module";
$requirements = array();
@mikespook
mikespook / hello.c
Created July 2, 2016 01:40
GIMP Plug-in in Golang
// Comes from http://developer.gimp.org/writing-a-plug-in/1/hello.c
#include <libgimp/gimp.h>
static void query (void);
static void run (const gchar *name,
gint nparams,
const GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals);
@mikespook
mikespook / content
Created January 21, 2015 03:45
A workflow of translation projects with VCS
A-Z
===
A brown fox jumped over a lazy dog.
a brown fox jumped over a lazy dog.
A brown fox jumped over a lazy dog.
A brown fox jumped over a lazy dog.
A brown fox jumped over a lazy dog.
029
package main
import (
"github.com/mikespook/golib/log"
"gopkg.in/gomail.v1"
)
func main() {
addr := "mail.awecent.com"
port := 25
--TEST--
Check for Yaf_Controller::finalize
--SKIPIF--
<?php if (!extension_loaded("yaf")) print "skip"; ?>
--FILE--
<?php
$config = array(
"application" => array(
"directory" => realpath(dirname(__FILE__)),
"dispatcher" => array(
@mikespook
mikespook / gomodule.go
Created May 6, 2013 13:24
SIGSEGV: segmentation violation PC=0xdeaddead signal arrived during cgo execution github.com/qiniu/py._Cfunc_PyImport_ExecCodeModule(0x304ca8, 0x2becc8, 0x304ca8) github.com/qiniu/py/_obj/_cgo_defun.c:547 +0x2f github.com/qiniu/py.ExecCodeModule(0x81012f8, 0x4, 0x2becc8, 0x0, 0x0, ...) github.com/qiniu/py/_obj/_cgo_gotypes.go:4120 +0x79 main.mai…
package main
import (
"fmt"
"time"
"github.com/qiniu/log"
"github.com/qiniu/py"
)
// -------------------------------------------------------------------
@mikespook
mikespook / gist:3003825
Created June 27, 2012 12:36
检测图片内容是否匹配
<?php
// 获得图片的采样
function samplingGif($filename) {
$sampling = array();
$img = imagecreatefromgif($filename);
$size = getimagesize($filename);
$w = $size[0];
$h = $size[1];
for($x = 0; $x < $w; $x++) {
$sampling[$x] = array();
@mikespook
mikespook / notify.go
Created March 21, 2012 16:06
inotify with pathes
package main
import (
"exp/inotify"
"log"
"os"
)
func init() {
f, _ := os.OpenFile("notify.log", os.O_CREATE|os.O_APPEND|os.O_RDWR, 0644)
package main
import (
"log"
"database/sql"
"encoding/json"
_ "github.com/ziutek/mymysql/godrv"
)
type Dict struct {