Skip to content

Instantly share code, notes, and snippets.

@afm-sayem
afm-sayem / parse.py
Created Sep 9, 2018
parse emails from files and separate the key components
View parse.py
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 Jan 11, 2018
take screenshot of novelship
View puppeteer
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 Sep 25, 2017
Json-schema import definitions
View country.schema.json
{
"$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,
View commit-msg
#!/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 Oct 24, 2016
Aurelia Template example
View todo.html
<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 Aug 8, 2016
Macbook Pro faulty thermal sensors
View SENSORS_REFERENCE(from mac forum)
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 Sep 20, 2017
Sample environment variables
View .env
# 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
View 50-synaptics.conf
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 Mar 12, 2016
Bangladesh map
View map.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.