Skip to content

Instantly share code, notes, and snippets.

Avatar

Basuke Suzuki basuke

View GitHub Profile
@basuke
basuke / main.js
Created Sep 18, 2020
JPEG rotation. Copy piano.jpg from `examples/commodetto/docs/piano.jpg`
View main.js
import JPEG from "commodetto/readJPEG";
import Poco from "commodetto/Poco";
import Resource from "Resource";
import config from "mc/config";
let poco = new Poco(screen, {rotation: config.rotation});
let gray = poco.makeColor(128, 128, 128);
poco.begin()
poco.fillRectangle(gray, 0, 0, poco.width, poco.height);
@basuke
basuke / create-vlog-project.py
Last active Aug 27, 2020
A python script to create a DaVinci Resolve project with today's date and import media files into default timeline.
View create-vlog-project.py
import os
import sys
import datetime
from glob import glob
from argparse import ArgumentParser
# settings
projectNamePrefix = "vlog-"
presetName = "Default" # You have to define this preset by your self. <----
View memory-breakdown
rss %
name
Vector 63291392 45.532768
StringImpl 22331392 16.065535
HashTable 11108352 7.991513
Misc. 8683520 6.247053
MetadataTable 5881856 4.231495
InstructionStream 3571712 2.569543
StringBuffer 3260416 2.345592
WeakBlock 1933312 1.390853
@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 )