Skip to content

Instantly share code, notes, and snippets.

View mshr-h's full-sized avatar
🏠
Working from home

Masahiro Hiramori mshr-h

🏠
Working from home
View GitHub Profile
@mshr-h
mshr-h / lszip.go
Created January 8, 2015 08:57
Print the contents of a zip archive.
package main
import (
"archive/zip"
"fmt"
"os"
)
func main() {
var r *zip.ReadCloser
package main
import (
"fmt"
"image"
"image/color"
"image/png"
"log"
"os"
)
package main
import (
"fmt"
"image"
"image/png"
"log"
"os"
)
from math import tanh
from pysqlite2 import dbapi2 as sqlite
class searchnet:
def __init__(self, dbname):
self.con = sqlite.connect(dbname)
def __del__(self):
import json
key = "fdksaljvdispoajhp89vdsa8sFDSpvdsa"
def flightsearch(origin, destination, depart_data):
url = "https://www.googleapis.com/qpxExpress/v1/trips/search?key=%s" % key
code = {
@mshr-h
mshr-h / malloc.c
Created June 17, 2015 02:52
simple malloc implementation
/* Include the sbrk function */
#include <unistd.h>
int has_initialized = 0;
void *managed_memory_start;
void *last_valid_address;
void malloc_init() { /* grab the last valid address from the OS*/
last_valid_address = sbrk(0);
/* we don't have any memory to manage yet, so
from pysqlite2 import dbapi2 as sqlite
import re
import math
def getwords(doc):
splitter = re.compile('\\W*')
# Split the words by non-alpha characters
words = [s.lower() for s in splitter.split(doc)
if len(s) > 2 and len(s) < 20]
import re
import math
def getwords(doc):
splitter = re.compile('\\W*')
# Split the words by non-alpha characters
words = [s.lower() for s in splitter.split(doc)
if len(s) > 2 and len(s) < 20]
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int h,w;
int width;
int height;
int total;
size_t frame_size;
@mshr-h
mshr-h / dp.py
Last active January 5, 2016 07:22
Knapsack problem
#-*- coding: utf-8 -*-
import sys
print("Input the item values:")
c = map(int, sys.stdin.readline().split(" "))
c.insert(0, 0)
print("Input the item sizes:")
a = map(int, sys.stdin.readline().split(" "))
a.insert(0, 0)