Skip to content

Instantly share code, notes, and snippets.

View thierrydev's full-sized avatar

Thierry Meliot thierrydev

View GitHub Profile
@thierrydev
thierrydev / homebrew-gnubin.md
Created June 4, 2020 07:45 — forked from skyzyx/homebrew-gnubin.md
Using GNU command line tools in macOS instead of FreeBSD tools

macOS is a Unix, and not built on Linux.

I think most of us realize that macOS isn't a Linux OS, but what that also means is that instead of shipping with the GNU flavor of command line tools, it ships with the FreeBSD flavor. As such, writing shell scripts which can work across both platforms can sometimes be challenging.

Homebrew

Homebrew can be used to install the GNU versions of tools onto your Mac, but they are all prefixed with "g" by default.

All commands have been installed with the prefix "g". If you need to use these commands with their normal names, you can add a "gnubin" directory to your PATH from your bashrc.

@thierrydev
thierrydev / rtorrent-watch-directorys.sh
Created April 17, 2020 05:47 — forked from Goon3r/rtorrent-watch-directorys.sh
Example of adding a watch directory to rtorrent via .rtorrent.rc
# The following line can be added to .rtorrent.rc to set up watch directories
#
# Replace:
# [WATCH_DIR] with the directory to watch for torrent files
# [DOWNLOAD_DIR] with the directory to save the files into
# [LABEL] with a label to apply to torrents added via this watch dir
# Important: Thus far i have not worked out how to use spaces in label names
# Do not include spaces for .torrent files will not be imported into rtorrent if you do
#
# Remove:
@thierrydev
thierrydev / Roman numerals kata.md
Last active April 16, 2020 22:36
Roman numerals kata

The Romans were a clever bunch. They conquered most of Europe and ruled it for hundreds of years. They invented concrete and straight roads and even bikinis⁶⁰. One thing they never discovered though was the number zero. This made writing and dating extensive histories of their exploits slightly more challenging, but the system of numbers they came up with is still in use today. For example the BBC uses Roman numerals to date their programs. For this Kata, write a function to convert from normal (Arabic) numbers to Roman Numerals: 1 -> I 10 -> X 7 -> VII etc.

There is no need to be able to convert numbers larger than about 3000. (The Romans themselves didn’t tend to go any higher).

Background information

Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 M 1000

Generally, symbols are placed in order of value, starting with the largest values. When smaller values precede larger values, the smaller values are subtracted from the larger values, and the result is added to the total. However, you can’t write numerals l

@thierrydev
thierrydev / netspeed.sh
Created April 9, 2020 00:02 — forked from rsvp/netspeed.sh
netspeed.sh : check download speed rate via command line | Linux bash script
#!/usr/bin/env bash
# bash 4.1.5(1) Linux Ubuntu 10.04 Date : 2013-07-11
#
# _______________| netspeed : check download speed via command line.
#
# Usage: netspeed [tokyo, london, usw, use, east, west, URL]
# ^default U.S. west coast.
# [ -speed_KB/sec ]
# ^negation activates the Mbps converter.
#
@thierrydev
thierrydev / WC_Order_Item_Product.php
Last active April 7, 2020 12:26
[Woocommerce WC_Order_Item_Product objects] #wc #woocommerce #WC_Order_Item_Product #php
// Get an instance of the WC_Order object
$order = wc_get_order($order_id);
// Iterating through each WC_Order_Item_Product objects
foreach ($order->get_items() as $item_key => $item ):
## Using WC_Order_Item methods ##
// Item ID is directly accessible from the $item_key in the foreach loop or
$item_id = $item->get_id();
@thierrydev
thierrydev / WC_Order.php
Last active April 7, 2020 12:25
Woocommerce WC_Order object #woocommerce #wc #wc_order #php
// Get an instance of the WC_Order object
$order = wc_get_order( $order_id );
$order_data = $order->get_data(); // The Order data
$order_id = $order_data['id'];
$order_parent_id = $order_data['parent_id'];
$order_status = $order_data['status'];
$order_currency = $order_data['currency'];
$order_version = $order_data['version'];
@thierrydev
thierrydev / p4MergeInstallGuide.md
Last active June 29, 2023 19:26
Installing and configuring P4Merge for Git on Ubuntu

Installing and configuring P4Merge for Git on Ubuntu

cd ~/Downloads
wget https://cdist2.perforce.com/perforce/r19.1/bin.linux26x86_64/p4v.tgz
@thierrydev
thierrydev / devops_best_practices.md
Created September 13, 2019 09:43 — forked from jpswade/devops_best_practices.md
Devops Best Practices

DevOps started out as "Agile Systems Administration". In 2008, Andrew Shafer did a talk called "Agile Infrastucture" addressing issues around involving more of the company in the same disciplines as programmers.

In 2009, Patrick Debois created "DevOpsDays" conference to help to bring it to light. However, it wouldn't begin to trend until about 2010, when people would begin to describe it as a standalone discipline.

Today, DevOps goes beyond just developers, systems administration and infrastructure, its about [dev, ops, agile, cloud, open source and business](https://blogs.the451group.com/opensource/2010/03/03/devops-mixing-dev-ops-agile-cloud-open-source-and-busi

@thierrydev
thierrydev / scrapy_test.py
Created April 4, 2019 21:23 — forked from boatgm/scrapy_test.py
scrapy examples
from scrapy.spider import BaseSpider
class MindhacksSpider(BaseSpider):
domain_name = "mindhacks.cn"
start_urls = ["http://mindhacks.cn/"]
def parse(self, response):
return []
SPIDER = MindhacksSpider()