Skip to content

Instantly share code, notes, and snippets.

View hasyimibhar's full-sized avatar
🏠
Working from home

Hasyimi Bahrudin hasyimibhar

🏠
Working from home
View GitHub Profile
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
This file has been truncated, but you can view the full file.
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
This file has been truncated, but you can view the full file.
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
from z3 import *
s = Solver()
thesum = 15
square = [[Int('x[{0}][{1}]'.format(i,j)) for j in range(3)] for i in range(3)]
# Each cell must be an int between 1 and 9
s.add([And(square[i][j] >= 1, square[i][j] <= 9) for i in range(3) for j in range(3)])
@hasyimibhar
hasyimibhar / homophones.py
Last active January 23, 2022 18:13
Search for homophones, and sort them by decreasing max word frequency
import json
from wordfreq import word_frequency
# Source: https://github.com/AllenDowney/ThinkPython2/blob/master/code/pronounce.py
def read_dictionary(filename='c06d'):
"""Reads from a file and builds a dictionary that maps from
each word to a string that describes its primary pronunciation.
Secondary pronunciations are added to the dictionary with
a number, in parentheses, at the end of the key, so the
key for the second pronunciation of "abdominal" is "abdominal(2)".
@hasyimibhar
hasyimibhar / index.js
Created November 6, 2020 06:47
formatjs/intl-datetimeformat with en-MY missing am/pm
require('@formatjs/intl-datetimeformat/polyfill-force');
require('@formatjs/intl-datetimeformat/locale-data/en');
require('@formatjs/intl-datetimeformat/locale-data/en-MY');
require('@formatjs/intl-datetimeformat/add-all-tz');
var date = new Date(Date.UTC(2020, 1, 1, 10, 10, 10, 0));
var format = new Intl.DateTimeFormat('en-MY', {
year: 'numeric',
month: 'short',
day: '2-digit',
@hasyimibhar
hasyimibhar / mykad.py
Created April 1, 2016 07:52
Simple MyKad Parsing
from collections import namedtuple
from datetime import date
import re
class InvalidMykadNumber(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
@hasyimibhar
hasyimibhar / breakdown.out
Last active March 24, 2016 08:04
Gosafe G79 Sample Device Packet (HEX)
f8
16 04 013fb82257f676
^ ^ ^
version packetid imei
? time mask? SYS GPS COT ADC DTT
00 42 01 1e 83 c9 7b 00 3b 11 03 47 37 39 15 56 31 2e 31 31 26 56 31 2e 30 2e 32 13 00 3f 46 00 2f 74 22 06 0e db c0 00 00 00 00 00 48 00 db 08 03 60 84 a8 13 08 ce d3 04 03 33 11 78 06 03 02 00 02 41 00
00 42 01 1e 83 c9 85 00 3b 11 03 47 37 39 15 56 31 2e 31 31 26 56 31 2e 30 2e 32 13 00 3f 46 00 2f 74 22 06 0e db c0 00 00 00 00 00 48 00 db 08 03 60 84 a8 13 08 ce d3 04 03 32 11 78 06 03 02 00 02 41 00
@hasyimibhar
hasyimibhar / reflection_method_get_parameters_benchmark.php
Created January 18, 2016 03:11
Benchmark of calling ReflectionMethod::getParameters
<?php
ini_set('memory_limit', '-1');
$n = 1000000;
class A {}
class B {}
class C {}
class D {}
#include <cstdio>
int main()
{
printf("Hello, world!\n");
return 0;
}