Skip to content

Instantly share code, notes, and snippets.

@afm-sayem
afm-sayem / parse.py
Created September 9, 2018 11:40
parse emails from files and separate the key components
import os, re, email, sqlite3
conn = sqlite3.connect('mails.db')
c = conn.cursor()
c.execute('''CREATE TABLE emails
(date text, frm text, recipient text, subject text, body text)''')
def cleanup(message):
clean_html = (re.sub('<[^<]+?>', '', data)).replace('&nbsp;', ' ');
@afm-sayem
afm-sayem / puppeteer
Last active January 11, 2018 09:02
take screenshot of novelship
const puppeteer = require('puppeteer');
(async() => {
const browser = await puppeteer.launch({args: ['--no-sandbox']});
const page = await browser.newPage();
await page.goto('https://www.novelship.com/products/12858', {waitUntil: 'networkidle2'});
await page.screenshot({path: 'example.png'});
@afm-sayem
afm-sayem / country.schema.json
Created September 25, 2017 08:13
Json-schema import definitions
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$id": "/home/username/projects/projectname/server/api/country/country.schema.json",
"properties": {
"active": {"type": "boolean"},
"created_at": {"$ref": "../base/definitions.schema.json#/datetime"} ,
"currency": {
"faker": "finance.currencyCode",
"maxLength": 255,
"minLength": 1,
@afm-sayem
afm-sayem / commit-msg
Created December 11, 2016 20:23
hooks
#!/usr/bin/env bash
# set this to your active development branch
develop_branch="master"
current_branch="$(git rev-parse --abbrev-ref HEAD)"
# only check commit messages on main development branch
[ "$current_branch" != "$develop_branch" ] && exit 0
# regex to validate in commit msg
@afm-sayem
afm-sayem / todo.html
Created October 24, 2016 15:26
Aurelia Template example
<template>
<h1>${heading}</h1>
<form submit.trigger="addTodo()">
<input type="text" value.bind="todoDescription">
<button type="submit">Add Todo</button>
</form>
<ul>
<li repeat.for="todo of todos">
@afm-sayem
afm-sayem / SENSORS_REFERENCE(from mac forum)
Created August 8, 2016 11:00
Macbook Pro faulty thermal sensors
TA0P: +36.5°C AMBIENT_TEMPERATURE
TA0p: +36.5°C
TA1P: +37.5°C AMBIENT1_TEMPERATURE
TA1p: +37.5°C
TC0C: +42.0°C CPU_DIE_CORE_TEMPERATURE Digital
TC0D: +43.5°C CPU_DIODE_TEMPERATURE Analog
TC0E: +43.8°C
TC0F: +44.8°C
TC0G: +99.0°C
TC0J: +1.0°C
@afm-sayem
afm-sayem / .env
Last active September 20, 2017 16:53
Sample environment variables
# https://www.npmjs.com/package/dotenv#rules
AWS_ACCESS_KEY=myaccesskey
AWS_BUCKET=mybucket
AWS_REGION=ap-southeast-1
AWS_SECRET_KEY=myawssecret
DATABASE_URL=postgres://username:password@localhost:5432/mydatabase
FACEBOOK_APPID=123456789
FACEBOOK_APPSECRET=myfacebooksecret
HOST=http://localhost:3000
NODE_ENV=development
Section "InputClass"
MatchIsTouchpad "on"
Identifier "Touchpads"
Driver "mtrack"
Option "Sensitivity" "0.45"
Option "FingerHigh" "12"
Option "FingerLow" "1"
Option "IgnoreThumb" "true"
Option "IgnorePalm" "true"
Option "TapButton1" "1"
@afm-sayem
afm-sayem / map.geojson
Last active March 12, 2016 08:59
Bangladesh map
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.