Skip to content

Instantly share code, notes, and snippets.

Makoto Tajitsu tzmfreedom

Block or report user

Report or block tzmfreedom

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
View mail-mock.php
<?php
class MailMockStreamWrapper
{
private $content = '';
private $position = 0;
public function stream_open($path)
{
stream_wrapper_restore("file");
View h2o-sample.conf
user: nobody
file.custom-handler:
extension: .php
fastcgi.connect:
port: /var/run/php-fpm/php-fpm.sock
type: unix
compress: ON
file.index: [ 'index.html', 'index.htm', 'index.txt', 'index.php' ]
View haskell-salesforce.hs
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE DeriveGeneric #-}
module Main where
import System.Environment (getArgs, getEnv)
import System.IO
import Network.HTTP.Conduit
import Network.URI
View SimpleDebugger.php
<?php
class Debugger {
private $transaction_id;
private $debug;
function __construct(bool $debug = false)
{
$this->transaction_id = 1;
$this->debug = $debug;
View error_listener.go
var AnnotatingErrorListener = function(annotations) {
antlr4.error.ErrorListener.call(this);
this.annotations = annotations;
return this;
};
AnnotatingErrorListener.prototype = Object.create(antlr4.error.ErrorListener.prototype);
AnnotatingErrorListener.prototype.constructor = AnnotatingErrorListener;
@tzmfreedom
tzmfreedom / sample-lexer.go
Created Oct 10, 2018
Sample Lexer by golang
View sample-lexer.go
package main
import (
"regexp"
)
func main() {
l := &Lexer{input: "=+*-/===abc=a1"}
tokens := []Token{}
for {
@tzmfreedom
tzmfreedom / mylogin_decode.php
Last active Sep 11, 2018
decode .mylogin.cnf to extract credential.
View mylogin_decode.php
#!/usr/bin/php -q
<?php
$fp = fopen("../.mylogin.cnf", "r");
if (!$fp) {
die("Cannot open .mylogin.cnf");
}
# read key
View s3_client.rb
# frozen_string_literal: true
class S3Client
def initialize(bucket_name:)
@bucket_name = bucket_name
end
def download(key:, filepath: nil)
return unless exist_key?(key)
if filepath
View class_self.rb
#!/usr/bin/env ruby
class Hoge
def foo
a = 123
(class << self; self; end).class_eval do
define_method(:bar) do
puts a
end
end
View lifegame.rb
#!/usr/bin/env ruby
class LifeGame
attr_accessor :height, :width, :sleep_time
def initialize(height:, width:, sleep_time: 0.25)
@height = height
@width = width
@sleep_time = sleep_time
@field = Array.new(height) { Array.new(width) { rand(2) == 0 } }
You can’t perform that action at this time.