Skip to content

Instantly share code, notes, and snippets.

@ctkjose
ctkjose / guide_ubuntu.md
Last active February 9, 2023 05:26
Guide Ubuntu

Users

Create a group:

sudo groupadd mygroup

Add user to group:

usermod -a -G mygroup user
@ctkjose
ctkjose / atom_php_setup.md
Last active April 19, 2022 16:08
My ATOM for PHP development

Atom Editor Setup

This is my atom (Version 1.48) setup for PHP develpment in a mac (updated for BigSur).

config.cson

 "default-language":
    defaultLanguage: "php"
 editor:
@ctkjose
ctkjose / code.md
Last active September 3, 2019 22:09
A simple printf like interpolation for Arduino

serial_printi()

This simple function does an interpolation on a formatted string similar to printf().

Its meant to be flexible and small.

void serial_printi(const char *format, ...){
	
	char ch;
	bool flgInterpolate = false;
@ctkjose
ctkjose / readme.md
Last active October 3, 2024 00:39 — forked from WebReflection/jsc
JavaScriptCore for macOS and Linux

JSC

JSC is the JavaScript engine from Apple's JavaScriptCore (WebKit) as a console application that you can use to run script in the terminal.

For more info visit the JSC's webkit wiki page.

Adding a shortcut to JSC

Using jsc is simple, the one issue is that Apple keeps changing the location for jsc. To deal with this issue I just create a symbolic link to the binary:

@ctkjose
ctkjose / testmd.md
Last active July 17, 2019 18:34
test github md

line 1
line 2

quote 1

line 3

quoute 2.1 quoute 2.2 line 4

@ctkjose
ctkjose / Util_Tile.php
Created May 31, 2019 04:36 — forked from rjmackay/Util_Tile.php
Tile utility class Handles converting slippy map tile numbers to lat/lon values Ported from: http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Java
<?php
/**
* Tile utility class
*
* Handles converting slippy map tile numbers to lat/lon values
* Ported from:
* http://svn.openstreetmap.org/applications/routing/pyroute/tilenames.py
* http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Java
*/
class Util_Tile {
@ctkjose
ctkjose / BITWISEMASKS.md
Last active January 6, 2019 20:20
Bitwise Masks

Using an Integer to store various indicators

We use an integer variable to store options using its bits.

A mask is an integer with one or more bits set to 1. Each bit represents a particular option or state.

An integer in C holds at least 16 bits (4 bytes);

int maskOptionIsReadable = 0x80; //1000 0000
@ctkjose
ctkjose / ubuntoserver.md
Created December 15, 2018 05:43
Setup Ubunto Server

MYSQL

mysql -u root -p 

mysql> GRANT ALL PRIVILEGES ON *.* TO 'ctk'@'%' IDENTIFIED BY 'password';
mysql> flush privileges;

Enable access from an external IP

@ctkjose
ctkjose / php_jsonrequests.md
Last active October 1, 2018 16:14
Handling JSON Data in PHP

Handling a JSON request

If data is send with a traditional multipart/form-data or application/x-www-form-urlencoded JSON data in FORM values will be automatically be converted and available in its corresponding $_POST, $_REQUEST or $_GET global.

This scenario is handle fairly simple with:

<?
$data = @json_decode($_POST['json_field']);
@ctkjose
ctkjose / komodo_nst_css_regex.md
Last active August 27, 2018 13:24
Refactor Komodo Edit Source Tree RegEx

Refactor NST.js

Source Tree uses the LineParserJS to parse CSS and SCSS. This is the refactoring I made to improve SASS support.

p = new LineParserJS(self.lang,
    ['@name,'],
    ['name {'],
    '[\\-*#.a-zA-Z_]' +