Skip to content

Instantly share code, notes, and snippets.

View paragasu's full-sized avatar

Jeffry L paragasu

  • Kota Kinabalu, Malaysia
View GitHub Profile
@paragasu
paragasu / dump-imap.py
Last active August 29, 2015 14:26 — forked from FiloSottile/dump-imap.py
Simple script to dump an IMAP folder into eml files
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import imaplib
import getpass
import argparse
argparser = argparse.ArgumentParser(description="Dump a IMAP folder into .eml files")
argparser.add_argument('-s', dest='host', help="IMAP host, like imap.gmail.com", required=True)
argparser.add_argument('-u', dest='username', help="IMAP username", required=True)
@paragasu
paragasu / checkpdfpagecolor.lua
Last active August 17, 2016 17:24
Print pdf page either color or black and white
local page_count = 1
local pdf = assert(io.popen('gs -q -o - -sDEVICE=inkcov wndw3-ebook.pdf', 'r'))
for line in pdf:lines() do
local s = {}, color
local c, m, y, k = string.match(line, "([%d%.]+)%s*([%d%.]+)%s*([%d%.]+)%s*([%d%.]+)")
-- avoid warning to get count as page
if tonumber(c) > 0 then
local cmax = math.max(c, y, m)
local cmin = math.min(c, y, m)
local delta = (cmax - cmin) / cmax
@paragasu
paragasu / fbpanel_default
Last active January 16, 2024 01:06
fbpanel configuration files
# dclock - digital clock
# space - just seize space
# pager - thumbnailed view of the desktop
# tray - tray for XEMBED icons (aka docklets)
# expand - specifies if plugin can accomodate extra space or not [optional]
# padding - extra padding around plugin [optional]
# config {} - block of plugin's private configuration.
# This part is plugin dependant
table Config
FontName: Tahoma
FontSize: 8
FontColor: #ffffff
ToolTip.FontSize: 9
ToolTip.FontName: gothic
ToolTip.ForeColor: #0000FF
ToolTip.BackColor: #FFFFFF
ToolTip.CaptionOnHover: true
ToolTip.CaptionPlacement: Right
@paragasu
paragasu / battery.sh
Created March 18, 2017 05:43
Play mp3 sound once battery reach 5%
#!/bin/bash
# Author Jeffry L <paragasu@gmail.com>
# 24 July 2014 Bilangau 12:47pm
# play random mp3 song once the battery reach 10%
# left
CHARGE=`acpi -b | cut -d, -f2`
VLC=`ps -e | grep vlc`
echo Battery Status: $CHARGE
@paragasu
paragasu / battery.sh
Last active March 18, 2017 06:05
Display notifcation when battery reach critical level.
#!/bin/bash
# Author Jeffry L. <paragasu@gmail.com>
# display notification when battery reach critical level
CHARGE=`acpi -b | cut -d, -f2`
VLC=`ps -e | grep vlc`
echo $CHARGE
# only play cvlc if no process exists yet
[Unit]
Description=CouchDB Service
After=network.target
[Service]
Type=simple
User=couchdb
ExecStart=/opt/couchdb/bin/couchdb
Restart=on-failure
@paragasu
paragasu / add_member.lua
Last active January 28, 2018 01:09
Lua add member
-- add name in the current database members list
function db.add_member(self, name)
local data, err = db:get('_security')
if not data then error(err) end
if not data.members then
data.members = {}
data.members.names = { name }
else
local current_members = data.members.names
data.members.names = table.insert(current_members, name)

Phi Getting Started

Work ethics

  1. Bring your own laptop.
  2. Commit to GitHub all work done before leaving the office.
  3. Dress code is smart casual.

Workspace

  1. Install Debian Linux ( XFCE Window Environment) https://cdimage.debian.org/images/unofficial/non-free/images-including-firmware/current/amd64/iso-cd/ , Create bootable USB https://www.howtogeek.com/howto/linux/create-a-bootable-ubuntu-usb-flash-drive-the-easy-way/, exta firmware https://cdimage.debian.org/cdimage/unofficial/non-free/firmware/bullseye/11.0.0/
  2. Install NodeJs https://github.com/nodesource/distributions/blob/master/README.md
db.ReturnRecord.find().forEach(doc => {
if (typeof doc.created_datetime == 'string') {
console.log(typeof doc.created_datetime, doc.created_datetime);
doc.created_datetime = new Date(doc.created_datetime);
db.ReturnRecord.save(doc)
}
})