Skip to content

Instantly share code, notes, and snippets.

Basuke Suzuki basuke

Block or report user

Report or block basuke

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@basuke
basuke / win-namedtemporaryfile.py
Last active Mar 19, 2018
Windows tempfile.NamedTemporaryFile : research
View win-namedtemporaryfile.py
a = tempfile.NamedTemporaryFile(delete=False)
file(a.name, 'r')
#>>> <open file 'c:\\users\\basuke\\appdata\\local\\temp\\tmpdclqbx', mode 'r' at 0x0000000009290DB0>
a = tempfile.NamedTemporaryFile(delete=True) # default
file(a.name, 'r')
#---------------------------------------------------------------------------
#IOError Traceback (most recent call last)
#<ipython-input-35-1cb82d16d8f2> in <module>()
#----> 1 file(a.name, 'r')
@basuke
basuke / Main.elm
Created Jan 30, 2018
Calc UI with sample event handling
View Main.elm
module Main exposing (main)
import Html exposing (Html, button, div, text)
import Html.Events exposing (onClick)
main : Program Never Model Msg
main =
Html.beginnerProgram
{ model = 0
View Main.elm
module Main exposing (main)
import Html exposing (Html, button, div, text)
import Html.Events exposing (onClick)
main : Program Never Model Msg
main =
Html.beginnerProgram
{ model = 0
View 1-ng-unpause-from-main.cpp
#include <curl/curl.h>
#include <stddef.h>
#include <unistd.h>
static const char* STATE_0 = "started";
static const char* STATE_1 = "paused";
static const char* STATE_2 = "resumed";
static size_t writeFunction(char* ptr, size_t blockSize, size_t numberOfBlocks, void* userData)
{
@basuke
basuke / memorandum.md
Last active Apr 7, 2017
Policy Memorandum
View memorandum.md

Policy Memorandum

U.S. Citizenship and Immigration Services
Office of the Director (MS 2000)
Washington, DC  20529-2000

March 31, 2017
PM-602-0142

SUBJECT:

@basuke
basuke / InvalidMimeGrammar.php
Created Apr 28, 2015
How to use RFC-invalid email addresses used by Japanese Cell carriers, DoCoMo and EZWeb using SwiftMailer
View InvalidMimeGrammar.php
<?php
class InvalidMimeGrammar extends \Swift_Mime_Grammar {
/**
* Get the grammar defined for $name token.
* @param string $name exactly as written in the RFC
* @return string
*/
public function getDefinition($name)
{
@basuke
basuke / playing.php
Created Oct 14, 2014
AlfredTweet patch. track informations should not be encoded to utf-8 at this point. Workflow seems to handle encoding correctly.
View playing.php
/**
* Description
* Accepts a player name as an argument and reads the values
* of the track name and artist for the currently playing track
* of that player
*
* @param $player - name of the player to read data from
* @return array - array of track name and artist for that player
*/
function get_tracks( $players )
@basuke
basuke / mosquitto.init.sh
Last active Feb 22, 2019
Amazon Linux Init script for mosquitto MQTT 3.1 broker.
View mosquitto.init.sh
#!/bin/bash
#
# mosquitto This shell script takes care of starting and stopping
# mosquitto (MQTT 3.1 broker) on Amazon Linux.
#
# chkconfig: - 58 74
# description: mosquitto is a MQTT 3.1 broker. \
# http://mosquitto.org/
### BEGIN INIT INFO
View daidokoro-monitor.py
# -*- coding: utf-8
import RPi.GPIO as GPIO
import mosquitto
import sys
from datetime import datetime
PINS = (18, 23, 24, 25)
SERVER = "sample.example.com"
@basuke
basuke / tilt3.py
Created Apr 28, 2013
Raspberry Pi Kitchen Range Monitor using GPIO
View tilt3.py
from time import sleep
import RPi.GPIO as GPIO
from sys import exit
GPIO.setmode(GPIO.BCM)
pins = [18,23,24,25]
[GPIO.setup(pin, GPIO.IN) for pin in pins]
You can’t perform that action at this time.