Skip to content

Instantly share code, notes, and snippets.

@arbinish
arbinish / go-embed.go
Created March 22, 2022 07:24
golang embed fs example
package main
import (
"embed"
"io/fs"
"log"
"net/http"
"os"
"strconv"
"time"
@arbinish
arbinish / py
Created July 18, 2021 12:11
python semver check
from packaging import version
version.parse('38.4.205') < version.parse('38.4.215')
@arbinish
arbinish / minesweeper.py
Created November 20, 2020 08:45
simple minesweeper operations in python3
from random import randint
from typing import List
class Board:
def __init__(self, length: int, width: int, bombs: int) -> List:
self.length = length
self.width = width
self.board = []
for i in range(length):
@arbinish
arbinish / namegenerator.py
Created August 25, 2019 08:18
random name generator based on mobyproject
# -*- coding: utf-8 -*-
'''
python port for https://github.com/moby/moby/blob/master/pkg/namesgenerator/names-generator.go
'''
import sys
import time
import random
@arbinish
arbinish / pytzconversion.py
Created June 26, 2018 08:59
python timezone conversion
import pytz
from datetime import datetime
utcnow = datetime.utcnow()
# localized (with tzinfo) version
localized_utcnow = pytz.utc.localize(utcnow)
# find pacific time
pacific = pytz.timezone('US/Pacific')
pacific.normalize(localize_utcnow)
@arbinish
arbinish / css3flip.html
Created September 21, 2017 01:48
css3 flip page effect
== .css ==
.postcard {
position: relative;
margin: 0 auto;
width: 400px;
height: 270px;
}
.postcard-front,
.postcard-back {
@arbinish
arbinish / keybase.md
Created February 8, 2017 07:27
keybase

Keybase proof

I hereby claim:

  • I am arbinish on github.
  • I am binish (https://keybase.io/binish) on keybase.
  • I have a public key ASAX2cotT0JJWp6RLrGWveriSvuL1YWXsRftyO0uK-7WrAo

To claim this, I am signing this object:

webpack = require('webpack');
module.exports = {
entry: './main.js',
output: {
path: './',
filename: 'index.js'
},
devServer: {
inline: true,
@arbinish
arbinish / procstat.c
Created July 13, 2016 10:09
/proc/<PID>/stat information
/*
* Displays linux /proc/pid/stat in human-readable format
*
* Build: gcc -o procstat procstat.c
* Usage: procstat pid
* cat /proc/pid/stat | procstat
*
* Homepage: http://www.brokestream.com/procstat.html
* Version : 2009-03-05
*
class AttrStorage(dict):
def __init__(self, fields=None, **kwargs):
""" only allow keys defined in fields """
self.fields = ()
if fields:
self.fields = fields
super(AttrStorage, self).__init__(kwargs)
def __getitem__(self, name):