Skip to content

Instantly share code, notes, and snippets.

View adriacidre's full-sized avatar

Adrià Cidre adriacidre

View GitHub Profile
@adriacidre
adriacidre / systemctl.md
Last active February 3, 2023 07:23
Systemctl Cheatsheet

Service Management

Starting and Stopping Services

Starting

sudo systemctl start application.service

or simply

sudo systemctl start application
@adriacidre
adriacidre / positive_non_four.rb
Last active August 29, 2015 13:55
Count the number of positive integers less than N that does not contains digit 4.
#
# Count the number of positive integers less
# than N that does not contains digit 4.
#
# Source: http://www.careercup.com/question?id=4752301805797376
class PositiveNonFour
def count_integers_non_four_less_than(max, strategy = :brute_force)
@filter = 4

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@adriacidre
adriacidre / Init_d_template
Created July 9, 2013 12:32
Simple init.d script template
#!/bin/bash
# myapp daemon
# chkconfig: 345 20 80
# description: myapp daemon
# processname: myapp
DAEMON_PATH="/home/wes/Development/projects/myapp"
DAEMON=myapp
DAEMONOPTS="-my opts"
@adriacidre
adriacidre / singletonTrait.php
Created May 2, 2013 19:21
PHP Singleton pattern using traits
<?php
trait Singleton
{
private static $_instance;
private function __construct(){}
public function __clone()
{
throw new Exception('This object cannot be cloned!');