Skip to content

Instantly share code, notes, and snippets.

Avatar
😪
Busy

Gerome Matilla manilarome

😪
Busy
  • Morioh, S City
View GitHub Profile
@manilarome
manilarome / hex-to-percentage.md
Created Oct 15, 2020
Hex color alpha to percentage
View hex-to-percentage.md
  • 100% — FF
  • 95% — F2
  • 90% — E6
  • 85% — D9
  • 80% — CC
  • 75% — BF
  • 70% — B3
  • 65% — A6
  • 60% — 99
  • 55% — 8C
@manilarome
manilarome / backdrop.lua
Created Sep 16, 2020
[awesomewm] Client backdrop effect
View backdrop.lua
local wibox = require('wibox')
local gears = require('gears')
local awful = require('awful')
local function update_backdrop(w, c)
local cairo = require('lgi').cairo
local geo = c.screen.geometry
w.x = geo.x
w.y = geo.y
@manilarome
manilarome / swipe-event.js
Created Sep 6, 2020
[Javascript] Swipe gestures
View swipe-event.js
// Copyright @manilarome
class SwipeEvent {
constructor(element, callback) {
this._passedElement = element;
this._passedCallback = callback;
this._startX = 0;
this._startY = 0;
this._endX = 0;
this._endY = 0;
this._startTime = 0;
@manilarome
manilarome / conflict.sh
Created Aug 31, 2020
Create git merge conflict
View conflict.sh
#!/usr/bin/env bash
mkdir git-repo
cd git-repo
git init
touch my_code.sh
git add my_code.sh
echo "echo Hello" > my_code.sh
git commit -am 'initial'
git checkout -b new_branch
@manilarome
manilarome / check-distro.sh
Created Aug 28, 2020
Check distro using $BASH
View check-distro.sh
#!/usr/bin/env bash
# return an awkable string consisting of
# unix OS type, or
# Linux dist, or
# a long guess (based on /proc), or
# no clue
giveUp () {
echo "Unknown"
exit 0
@manilarome
manilarome / git-reset-history.md
Created May 11, 2020
Reset github repo history
View git-reset-history.md

My dotfiles became so big that cloning it even using depth 1 is a pain in the ass. Yeah, I have a very slow internet connection. That's why I need to reset the history.

$ # Reset history
$ rm -rf .git

$ # Re-initialize
$ git init
$ # Add file contents to index
$ git add .

@manilarome
manilarome / call-meta-call.lua
Created Apr 24, 2020
Lua __call methamethod example
View call-meta-call.lua
#!/usr/bin/env lua
meta_call = require('meta-call')
-- Index
str_table = {
'string1',
'string2',
'string3',
'string4'
@manilarome
manilarome / check-capslock-status-linux.cpp
Last active Mar 4, 2020
Check CapsLock Status Programatically in Linux
View check-capslock-status-linux.cpp
#include <stdio.h>
#include <stdlib.h>
#include <X11/XKBlib.h>
/* Compile this with -lX11 */
int main ()
{
Display *display;
Status status;
You can’t perform that action at this time.