Skip to content

Instantly share code, notes, and snippets.

@duffn
duffn / creating_a_date_dimension_table_in_postgresql.sql
Last active July 2, 2024 21:38
Creating a date dimension table in PostgreSQL
DROP TABLE if exists d_date;
CREATE TABLE d_date
(
date_dim_id INT NOT NULL,
date_actual DATE NOT NULL,
epoch BIGINT NOT NULL,
day_suffix VARCHAR(4) NOT NULL,
day_name VARCHAR(9) NOT NULL,
day_of_week INT NOT NULL,
@taoyuan
taoyuan / generate_self_signed_certification.md
Last active July 2, 2024 21:38
Generation of a Self Signed Certificate

Generation of a Self Signed Certificate

Generation of a self-signed SSL certificate involves a simple 3-step procedure:

STEP 1: Create the server private key

openssl genrsa -out cert.key 2048

STEP 2: Create the certificate signing request (CSR)

openssl req -new -key cert.key -out cert.csr
@elucify
elucify / gist:c7ccfee9f13b42f11f81
Created January 23, 2015 17:17
BASH: set variables for ANSI text color escape sequences
RESTORE=$(echo -en '\033[0m')
RED=$(echo -en '\033[00;31m')
GREEN=$(echo -en '\033[00;32m')
YELLOW=$(echo -en '\033[00;33m')
BLUE=$(echo -en '\033[00;34m')
MAGENTA=$(echo -en '\033[00;35m')
PURPLE=$(echo -en '\033[00;35m')
CYAN=$(echo -en '\033[00;36m')
LIGHTGRAY=$(echo -en '\033[00;37m')
LRED=$(echo -en '\033[01;31m')

Half-Life 2 on the Switch

This is a guide for running Half-Life 2 on your Switch. Please be aware that this isn't a great way of playing Half-Life 2 - do not expect this mod to work perfectly.

Thank you to Bringus Studios for fixing save files not showing up!

NOTE: I am assuming that you have basic knowledge about how modding games on the Switch works. I will not provide support for questions like "how do I install Atmosphère / CFW", "how do I make an emuMMC", "how do I extract games", etc. For help with modding your console, see the NH Switch Guide.

WARNING: While this mod should be fairly safe to use, I do not take any responsibility if your Portal save data is deleted, you get banned from Nintendo Switch Online, or if your Switch explodes.

@leastbad
leastbad / action_mailbox.md
Last active July 2, 2024 21:36
Action Mailbox: The Missing Manual

This is all you really need to know in order to make Action Mailbox work in development.

  1. Fire up ngrok http 3000 and make note of your subdomain for steps 3 and 8.
  2. Create a Mailgun account because they offer sandbox addresses; grab your domain from the Dashboard.
  3. Go into Receiving and create a catch-all route pointing to: https://XXX.ngrok.io/rails/action_mailbox/mailgun/inbound_emails/mime
  4. Add your Mailgun API key to your credentials:
action_mailbox:
 mailgun_api_key: API KEY HERE

Using GitHub CLI on Perlmutter

Installation

  1. Go to the release page of cli/cli, and get the compatible build for Perlmutter. The latest version as of July 1, 2024 is GitHub CLI 2.52.0 linux amd64
  2. Untar the file, and move the single binary executable gh to path which is included in the list of the env PATH, or add the path to it in your $HOME/.bashrc.ext;
  3. Similarly, move the share/man subdiretory into a place already pointed to by the env MANPATH, or the new path to $HOME/.bashrc.ext;
  4. Add bash (or other shell) completion by adding eval "$(gh completion -s bash)" into $HOME/.bashrc.ext. After opening a new terminal, you would be able to test the installation with which gh, man gh and use the tab key for sub-command completion (tab once to auto complete the command, tab twice to list all possible completions).

My additions to $HOME/.bashrc look lik

@sunmeat
sunmeat / snake.cpp
Last active July 2, 2024 21:35
snake game cpp console application code example
#include <iostream>
#include <windows.h>
#include <conio.h>
using namespace std;
int main() {
srand(time(0)); // запуск генератора случайных чисел
system("title Snake Game");
system("mode con cols=70 lines=31"); // установка размеров окна консоли
MoveWindow(GetConsoleWindow(), 50, 50, 2000, 2000, true); // установка стартовой позиции окна консоли (50 и 50 - это пиксели
@mutin-sa
mutin-sa / Top_Public_Time_Servers.md
Last active July 2, 2024 21:29
List of Top Public Time Servers

Google Public NTP [AS15169]:

time.google.com

time1.google.com

time2.google.com

time3.google.com

@disler
disler / README_MINIMAL_PROMPT_CHAINABLE.md
Last active July 2, 2024 21:27
Minimal Prompt Chainable for zero library sequential prompt chaining

Minimal Prompt Chainable

Sequential prompt chaining in one method with context and output back-referencing.

Files

  • main.py - start here - full example using MinimalChainable from chain.py to build a sequential prompt chian
  • chain.py - contains zero library minimal prompt chain class
  • chain_test.py - tests for chain.py, you can ignore this
  • requirements.py - python requirements

Setup