Skip to content

Instantly share code, notes, and snippets.

View rodelta's full-sized avatar
🤔

CR De la Rivera rodelta

🤔
View GitHub Profile
@rodelta
rodelta / action snippet
Created August 24, 2014 22:32
action snippet for sails
<snippet>
<content><![CDATA[
/**
* Controller.${1:action}()
*/
${1:action}: function (req, res) {
${2:}
//code
return res.view();
},
@rodelta
rodelta / ticket.py
Created September 27, 2016 05:35
Manual ticket creation in web2py
try:
0/0
except Exception as e:
from gluon.restricted import RestrictedError
RE = RestrictedError(__file__, '', e, locals())
RE.log(request)
@rodelta
rodelta / Roelementary.bash
Last active November 8, 2021 06:20
Install Elementary-OS Ro's way
#Download Elementary OS from here:
#http://sourceforge.net/projects/elementaryos/files/stable/
#First you update your system
sudo apt-get update && sudo apt-get dist-upgrade
#Install Google Chrome
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
@rodelta
rodelta / hexToBinary.cs
Last active February 23, 2018 23:07
Takes a hex string of arbitrary value and turns it into a binary string. Works with hex strings that would overflow number types (e.g. EPC codes).
/* Creates a binary string from a arbitrary long hex string
Taken from https://github.com/dannyhaak/TagDataTranslation/
*/
private static string HexToBinary(string hex)
{
StringBuilder binary = new StringBuilder();
for (int i = 0; i < hex.Length; i++)
{
int integer = Convert.ToInt16(hex.Substring(i, 1), 16);
binary.Append(Convert.ToString(integer, 2).PadLeft(4, '0'));
@rodelta
rodelta / silentExceptions.js
Created December 15, 2018 13:26
Catch all non handled exceptions in node
process.on('unhandledRejection', err => console.error(err))
@rodelta
rodelta / gln.bash
Created February 12, 2019 17:30
git log nice
git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)'
@rodelta
rodelta / gist:39b85d097351f0d7c6acc26196c64c29
Last active May 20, 2019 11:28
clean git local branches
git branch --merged master | grep -v "\* master" | xargs -n 1 git branch -d
@rodelta
rodelta / InterfaceReplace.sh
Last active October 17, 2019 19:32
Mass replace declaration files to Interfaces files in console
for f in **/*.d.ts; do mv "$f" "$(echo "$f" | sed s/\.d\.ts/\.ts/)"; done