Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

davepcallan / ChatGPTAPIExample.cs
Created March 7, 2024 13:02
Simple example of integrating with ChatGPT API from .NET
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using System.Text;
using System.Text.Json;
namespace Samples;
public class ChatGPTAPIExample(ILogger<ChatGPTAPIExample> logger, IConfiguration configuration)
private string Prompt = "Please explain the following code :";
olmosleo / postfix_admin_tools.txt
Last active April 23, 2024 00:30
Postfix Admin Tools - Comandos para administración de POSTFIX
# Deleting mail from MAIL-DAEMON in queue
for i in `mailq | grep MAILER-DAEMON | cut -f 1 -d " "`; do postsuper -d $i ; done
# So you get the number of all active mails with the command:
postqueue -p | egrep -c "^[0-9A-F]{10}[*]"
# and the number of all deferred mail with:
postqueue -p | egrep -c "^[0-9A-F]{10}[^*]"
# muestra cola
leocomelli /
Last active April 23, 2024 00:28
Lista de comandos úteis do GIT



  • Modificado (modified);
  • Preparado (staged/index)
  • Consolidado (comitted);


gioamato /
Last active April 23, 2024 00:18
Google Apps script to restore Google Drive files to a previous version after a cryptolocker attack
// GDCR - Google Drive Cryptolocker Restore
// Ref.
// Configuration
// Note: Add Drive to the Services area and login with your account on the first run
var folderId = '0AIwBM53EGRt-Uk9PVA' // Enter folder Id here (from browser, after .../folders/ path)
var virusAttackDate = new Date("2022-11-11"); // Attack date in "YYYY-MM-DD" format
var virusExtension ='h777XRgNVM777xM'; // Enter cryptolocker file extension
dawidof / optimization.rake
Created February 6, 2023 17:29 — forked from merqlove/optimization.rake
PostgreSQL optimization tasks for ActiveRecord
namespace :optimization do
desc "Provide DB vacuum for production environment"
task :vacuum => :environment do
tables = ActiveRecord::Base.connection.tables
tables.each do |table|
ActiveRecord::Base.connection.execute("VACUUM FULL ANALYZE #{table};")
rescue Exception => exc
Rails.logger.error("Database VACUUM error: #{exc.message}")
mohanpedala /
Last active April 22, 2024 23:58
set -e, -u, -o, -x pipefail explanation
sainnhe / gruvbox-material-alacritty.yml
Last active April 22, 2024 23:51
Gruvbox Material for Alacritty
# The definition of color schemes.
gruvbox_material_hard_dark: &gruvbox_material_hard_dark
background: '0x1d2021'
foreground: '0xd4be98'
black: '0x32302f'
red: '0xea6962'
green: '0xa9b665'
riipandi /
Created July 12, 2012 12:16
Linux Command Cheat Sheet

#Linux Cheat Sheet

##File Commands:

  • ls – directory listing
  • ls -al – formatted listing with hidden files
  • cd dir - change directory to dir
  • cd – change to home
  • pwd – show current directory
  • mkdir dir – create a directory dir
  • rm file – delete file
Jibbarth /
Last active April 22, 2024 23:34
⚡Recreate Github CLI OAuth feature in a Symfony command ⚡

⚡Recreate Github CLI OAuth feature in a Symfony command ⚡

Github recently released a CLI tool to manage issues and PR directly from your terminal. As I work on some open source projects, I downloaded it to give a try.

And at first launch, the CLI ask to connect by using OAuth. It propose to press "Enter" to open in my browser, and catch correctly the access_token.

That .. blown my mind 🤯 I didn't expect we can connect through terminal like this. So, as it's open source, I dived into the code source.