Skip to content

Instantly share code, notes, and snippets.

View rodrigoratan's full-sized avatar
🏠
Working from home

Rodrigo Ratan rodrigoratan

🏠
Working from home
View GitHub Profile
@davidfowl
davidfowl / MinimalAPIs.md
Last active June 28, 2024 17:42
Minimal APIs at a glance
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aryamanpuri
aryamanpuri / SpeechRecognition.js
Last active June 5, 2024 15:17
Speech Recognition using Web Speech API
import React, { Component } from "react"
//------------------------SPEECH RECOGNITION-----------------------------
const SpeechRecognition = SpeechRecognition || webkitSpeechRecognition
const recognition = new SpeechRecognition()
recognition.continous = true
recognition.interimResults = true
recognition.lang = 'en-US'
@carlashley
carlashley / recovery_boot.txt
Created February 6, 2020 00:00
macOS Recovery Boot Mode Commands
# Local
sudo /usr/sbin/nvram recovery-boot-mode=unused # Boot to local recovery partition.
# Internet
sudo /usr/sbin/nvram internet-recovery-mode=RecoveryModeNetwork # Internet Recovery (same as SHIFT+OPT+CMD+R)
sudo /usr/sbin/nvram internet-recovery-mode=RecoveryModeDisk # Local Recovery Partition (Same as CMD+R)
sudo /usr/sbin/nvram internet-recovery-mode=DiagsModeDisk # Local Hardware Diagnostics (Same as D)
sudo /usr/sbin/nvram internet-recovery-mode=DiagsModeNetwork # Internet Hardware Diagnostics (Same as OPT+D)
# Sourced from
@bandaangosta
bandaangosta / pzem_004t.py
Last active June 4, 2024 01:55
Reading PZEM-004t power sensor (new version v3.0) through Modbus-RTU protocol over TTL UART
# Reading PZEM-004t power sensor (new version v3.0) through Modbus-RTU protocol over TTL UART
# Run as:
# python3 pzem_004t.py
# To install dependencies:
# pip install modbus-tk
# pip install pyserial
import serial
import modbus_tk.defines as cst

Install dlib and face_recognition on a Raspberry Pi

Instructions tested with a Raspberry Pi 2 with an 8GB memory card. Probably also works fine on a Raspberry Pi 3.

Steps

Download the latest Raspbian Jessie Light image. Earlier versions of Raspbian won't work.

Write it to a memory card using Etcher, put the memory card in the RPi and boot it up.

@JoanM
JoanM / BynderCurl.cs
Created December 9, 2016 14:55
Async Curl to Bynder
public async Task<string> DoCurlAsync()
{
using (var httpClient = new HttpClient())
using (var httpResonse = await httpClient.GetAsync("https://www.bynder.com"))
{
return await httpResonse.Content.ReadAsStringAsync();
}
}
@alfeugds
alfeugds / CurrencyConverter.cs
Last active July 13, 2023 06:01
Xamarin Forms Currency Mask for Entry fields
using System;
using System.Globalization;
using System.Text.RegularExpressions;
using Xamarin.Forms;
namespace MyProject.Util
{
/// <summary>
/// Converter for using in Entry fields for masked input of currency.
/// <para>The binded property must be of type decimal, and must invoke the PropertyChangedEventArgs event whenever the value is changed, so that the desired mask behavior is kept.</para>
@ech01
ech01 / DnnScheduleExample.cs
Last active September 13, 2021 18:41
DNN Scheduler Example
using System;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Configuration;
using DotNetNuke.Services.Mail;
using DotNetNuke.Entities.Portals;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Portals;
@NickCraver
NickCraver / ExampleUsage.cs
Last active November 27, 2021 04:24
Code to mark a SQL string before it's passed to Dapper.
public static List<T> Query<T>(this DataContext db, string sql, object param = null, int? commandTimeout = null, IDbTransaction transaction = null, [CallerFilePath]string fromFile = null, [CallerLineNumber]int onLine = 0, string comment = null)
{
using (db.Connection.EnsureOpen())
{
try
{
return db.Connection.Query<T>(MarkSqlString(sql, fromFile, onLine, comment), param, transaction ?? db.Transaction, true, commandTimeout).AsDapperList();
}
catch (SqlException ex) when (ex.Is(SqlErrorCode.DatabaseReadOnly_3906))
{