Skip to content

Instantly share code, notes, and snippets.

View rawnly's full-sized avatar
🧨
fixing my printer

Federico rawnly

🧨
fixing my printer
View GitHub Profile
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 24,
// font family with optional fallbacks
fontFamily: '"Fira Code", Menlo, "DejaVu Sans Mono", "Lucida Console", monospace',
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
cursorColor: '#1df9ca',
@rawnly
rawnly / getMenuItem.js
Last active March 16, 2018 10:41
Get item from an electron menu or trayMenu
// Thanks to @Tazaf
module.exports = function getItem(label, menu) {
for ( i in menu.items ) {
if ( menu.items[i].submenu && menu.items[i].submenu.items ) {
var subItem = menu.items[i].submenu.items.find((item) => {
return item.label === label
})
if (subItem) {
@rawnly
rawnly / Ranking.php
Created May 17, 2017 15:14 — forked from touhonoob/Ranking.php
Reddit Ranking Algorithms in PHP
<?php
/**
* Ranking Library
* contains alogrithms for story ranking
* Basically a PHP Implementation of reddits algorithms
*
* @author Lucas Nolte <lnolte@i.biz>
* @since 0.1
* @package Polska Wiadomosc
* @subpackage Libraries
@rawnly
rawnly / countdown.js
Created May 21, 2017 19:29
Countdown function in pure js (no jquery)
// @author: Rawnly
// @version: 1.0.0
// @url: https://rawnly.com
function countDown(id, date = "Jan 5 2018") {
var int = setInterval(function() {
// Get todays date and time
var now = new Date().getTime();
// Find the distance between now an the count down date
@rawnly
rawnly / Usage.md
Last active March 13, 2018 11:48
Javascript TypeCheck

Usage

Use it like:

  import typeCheck from './typeCheck';

  /**
   * @name round
   * @description Write a function that round a number (`n`) to given decimal places.
 *
@rawnly
rawnly / install_node.sh
Created March 16, 2018 00:03
Install nodejs
cd ~;
curl -sL https://deb.nodesource.com/setup_8.x -o nodesource_setup.sh;
sudo bash nodesource_setup.sh;
sudo apt-get install nodejs;
npm i -g yarn
# What files or folders to take backup of.
backup_folder="/var/www/federicovitale.me";
# Delete modules folders
rm -rf "$backup_folder/node_modules";
rm -rf "$backup_folder/static/bower";
day=$(date +%d%m%y);
hostname=$(hostname -s);
archive_file="$hostname-$day.tar.gz";
@rawnly
rawnly / git-login.js
Created April 17, 2018 13:37
GitHub nodejs login via user credentials
const got = require('got');
const chalk = require('chalk');
(async () => {
console.clear();
const [username, password] = process.argv.splice(2);
if ( username.includes('-') ) {
const flag = username.replace(/\-+/, '');
import 'babel-polyfill';
import { URL } from 'url';
import { JSDOM } from 'jsdom';
import got from 'got';
/**
*
* @name zippy
* @param {String} rawUrl
@rawnly
rawnly / nginx-server-manager.sh
Created April 27, 2018 14:20
Manage nginx service
function webserver {
case "$1" in
"check")
nginx -t
;;
"stop"|"start"|"restart"|"status")
systemctl $1 nginx;
;;
*)
echo "Usage:\n $ $0 {start|stop|restart|check|status}";