Skip to content

Instantly share code, notes, and snippets.

View kirubz's full-sized avatar
🎯
Focusing

Kirubaharan Palani kirubz

🎯
Focusing
View GitHub Profile
@kirubz
kirubz / TimeAgo.jsx
Created August 22, 2024 16:00 — forked from johndavedecano/TimeAgo.jsx
TimeAgo component using date-fns
import React, {Component} from 'react';
import differenceInSeconds from 'date-fns/difference_in_seconds';
import distanceInWordsToNow from 'date-fns/distance_in_words_to_now';
class TimeAgo extends Component {
componentDidMount() {
if (this.props.isLive) {
this.updateTime();
}
@kirubz
kirubz / README.md
Created April 2, 2022 17:13 — forked from IanVaughan/README.md
Push branch from one remote into another

Push branch from one remote into another

Add remote2 as a remote

$ git remote -v
remote2 git@github.com:repo2.git (fetch)
remote2 git@github.com:repo2.git (push)
origin  git@github.com:repo.git (fetch)
origin  git@github.com:repo.git (push)

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@kirubz
kirubz / mysql-docker.sh
Created March 20, 2019 16:13 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@kirubz
kirubz / email_sendfile.lua
Created November 13, 2018 03:32 — forked from Danukeru/email_sendfile.lua
A simple LUA script to send an e-mail with an attachment.
-- requires an SMTP server to send emails
local smtp = require("socket.smtp")
local ltn12 = require("ltn12")
local mime = require("mime")
from = "<me@my.email.com>"
rcpt = {
"<somebob@testemail.com>"
-- mathlib.lua
--[[
Maths extension library for use in Corona SDK by Matthew Webster.
All work derived from referenced sources.
twitter: @horacebury
blog: http://springboardpillow.blogspot.co.uk/2012/04/sample-code.html
code exchange: http://code.coronalabs.com/search/node/HoraceBury
github: https://gist.github.com/HoraceBury

HP ZBook 15 G3 - Ubuntu GNOME - 16.04 LTS

*: Included in the image

Disk /dev/nvme0n1: 477 GiB, 512110190592 bytes, 1000215216 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
@kirubz
kirubz / example.lua
Created November 20, 2017 21:34 — forked from mebens/example.lua
Doubly linked list in Lua
require("list")
local a = { 3 }
local b = { 4 }
local l = list({ 2 }, a, b, { 5 })
l:pop()
l:shift()
l:push({ 6 })
l:unshift({ 7 })
@kirubz
kirubz / lua-uuid.lua
Created March 23, 2017 06:22 — forked from jrus/lua-uuid.lua
quick lua implementation of "random" UUID
local random = math.random
local function uuid()
local template ='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
return string.gsub(template, '[xy]', function (c)
local v = (c == 'x') and random(0, 0xf) or random(8, 0xb)
return string.format('%x', v)
end)
end
@kirubz
kirubz / xhr.js
Created January 30, 2017 12:55 — forked from jkk/xhr.js
function postJson(method, url, params) {
let xhr = new XMLHttpRequest();
xhr.open(method, url, true);
xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
xhr.send(JSON.stringify(params));
xhr.onreadystatechange = function() {
let status;
let data;
if (xhr.readyState === 4) {
status = xhr.status;