Skip to content

Instantly share code, notes, and snippets.

View notalentgeek's full-sized avatar

Mikael Kristyawicaksono notalentgeek

View GitHub Profile
@notalentgeek
notalentgeek / AlphaColorChange.pde
Last active December 8, 2016 10:51
Processing sketch to change alpha of a color programmatically.
color alphaColor;
// I test this program using red color.
// But you can use any color you want.
color mainColor = color(255, 0, 0);
// The least alpha value is 0 while
// the most alpha value is 255.
// This variable is the starting alpha
// value.
int alphaValue = 255;
@notalentgeek
notalentgeek / AlphaColorChangeFunction.pde
Created December 8, 2016 11:11
A Processing function to change color's opacity.
public color ChangeAlpha(
color _color,
int _desiredAlpha
){ return _color & ~#000000 | (_desiredAlpha << 030); }
@notalentgeek
notalentgeek / timer_second_change.py
Last active December 12, 2016 16:55
Python class to help to execute code for every second passed.
import datetime as dt
# This is a class to detect change in second.
# My first initial idea was to make a codes
# those execute for every second passed.
# The method here is to take the current time
# from datetime.datetime.now().time(), extract
# the second and then execute something when
# the value changes (most of the time codes
# will be executed for every one second).
@notalentgeek
notalentgeek / note_fm.py
Last active December 20, 2016 00:19
My Python codes to automate my markdown notes.
import copy
import datetime as dt
import os
import shutil
import subprocess
import sys
import time
def main(args):
@notalentgeek
notalentgeek / pitch_volume_detection_alsaaudio.py
Created December 22, 2016 09:10
Simple proof of concept to stream audio from main microphone and then extract its pitch and volume properties on the fly.
# Only works with operating system that uses
# AlsaAudio as audio driver. Most Linux distros
# are using this (Debian, Ubuntu). Does not work
# any where else (MacOS or Windows).
#
# This is a class to stream audio data from
# computer microphone then extract the pitch
# and the volume from it. This is done using
# AlsaAudio and Aubio Python library. The
# AlsaAudio is used to turn on the computer
@notalentgeek
notalentgeek / note_init.py
Last active December 24, 2016 09:41
Python automation script for initiating my notes.
# This is a Python script to initiate notes with all images.
# Images are all already re - sized into 600 pixel width with
# proportional height. First is that I need to get the directory
# that is filled with the notes I want to init.
import datetime as dt
import io
import os
import shutil
import subprocess
@notalentgeek
notalentgeek / mass_add_same_extension.py
Last active December 24, 2016 19:51
A Python script to mass add same extension to all files in a folder.
# This is a Python script to mass add same
# extension for all files in a folder.
import os
import shutil
import sys
def MassAddSameExtension(_targDir, _ext):
# Get the list of all files in the targetDirectory.
targDirList = os.listdir(_targDir)
@notalentgeek
notalentgeek / see_fm_arrange_numbering.py
Last active December 25, 2016 14:57
Python script to arrange numbering in my "see" folder.
# Python script to arrange files numbering in my personal see folder.
from tzlocal import get_localzone
import datetime as dt
import os
import shutil
import sys
def ArrangeFilesNumbering(_startDir):
# Get the list of files and folders in
@notalentgeek
notalentgeek / see_fm.py
Last active December 25, 2016 20:14
Python automation script for managing my personal "see" folder.
from os import listdir
from os.path import isfile, join
from tzlocal import get_localzone
import datetime as dt
import os
import shutil
import sys
# Constants.
# Constant for a backup folder name.
@notalentgeek
notalentgeek / DetectChangeInTSecond.js
Last active January 10, 2017 23:26
JavaScript function to detect interval (1, 2, 3, ... seconds) using operating system internal clock.
// Function to detect if x second is already passed.
// If each tick is more than 1 second then this
// function is screwed, but that will not happen
// (hopefully).
function DetectChangeInTSecond(_t, _date){
this.t = _t;
this.currSecond = _date.getSeconds();
this.currSecondPrev = this.currSecond;
this.counter = 0;