Skip to content

Instantly share code, notes, and snippets.

@elifiner
elifiner / chat.py
Last active April 27, 2023 03:23
Simple command line chat with Open AI ChatGPT
import os
import openai
import readline
from datetime import date
from dotenv import load_dotenv
load_dotenv()
openai.api_key = os.getenv('OPENAI_API_KEY')
assistant_name = "Assistant"
@elifiner
elifiner / momentjs-timezones.js
Created July 20, 2021 18:31
Parse timezones with momentjs
const moment = require('moment-timezone');
// parse time with timezone, convert to UTC, resulting object is in UTC
console.log(moment.utc('23:05+02:00', ['hh:mm a ZZ', 'HH:mmZZ'], true).format());
// parse time with timezone, resulting object is in timezone specified in the time string
console.log(moment.parseZone('23:05+02:00', ['hh:mm a ZZ', 'HH:mmZZ'], true).format());
// parse time with timezone, resulting object is converted to timezone specified in the timezone parameter
console.log(moment.tz('23:05+02:00', ['hh:mm a ZZ', 'HH:mmZZ'], 'America/Vancouver').format());
Hey there. My name is Eli Finer.
Welcome to Wuju.
These are difficult times in India. There is fear, uncertainty and doubt everywhere. Hospitals are running out of critical supplies. Many people are sick and some are dying. And yet there is light as well. The Indian people are coming together, helping each other harnessing resources and working to resolve the situation with fierce determination.
Any difficulty we face can be made worse or better, depending on the quality of our thoughts. Negative, self-defeating thoughts make every challenge seem impossible. They drain our energy and limit our options. Positive or clear thinking can help us see new ways to improve our situation. It can help us find compassion for ourselves and for others and even improve the way our bodies deal with disease.
We can't change how we feel and what we think directly. Trying to do this through sheer force of will usually results in self judgment, shame and guilt. And that only adds to the already full arsenal of negative think
var Quotes = [
{
"text":"You don't fail until you stop trying.",
"from":"Albert Einstein"
},
{
"text":"I failed my way to success.",
"from":"Thomas Edison"
},
{
<?php
$options = [
'a' => [1,2],
'b' => [1,2,3],
];
function cartesian($array)
{
if ($array)
@elifiner
elifiner / openssl_self_signed.md
Created November 26, 2019 22:41 — forked from gmassawe/openssl_self_signed.md
Creating Self Signed Certificate

Create self-signed certificates with OpenSSL

Root CA

Create Root CA key (enable password with '-des3' option)

$ openssl genrsa -des3 -out root.key 4096

Create Root CA

@elifiner
elifiner / wp-login-stubs.php
Last active November 9, 2019 01:11
Wordpress 2.0 wp-login.php for refactoring
<?php
// RG: Stubs to make wp-login.php run independently of Wordpress codebase on modern PHP.
error_reporting(0);
$_REQUEST['action'] = $_REQUEST['action'] ?? '';
class wpdb {
public $users;
(cat .env.default .env | sed 's/^/export /'; echo env) | env -i bash - | grep -v SHLVL | grep -v ^_ | grep -v PWD | sort
@elifiner
elifiner / scroll-indicators.html
Created April 30, 2019 01:11
CSS indicators for scrollable content
<html>
<style>
.div1 {
position: relative;
display: inline-block;
border: 1px solid #ccc;
}
.div1::after {
content: "";
@elifiner
elifiner / pivot.php
Created March 11, 2019 23:13
Compute simple pivot table of a CSV file
<?php
if (count($argv) < 4) {
echo "
Usage: php pivot.php <file> <column>[,<column>] <column>:<func>
Examples:
php pivot.php data.csv Type sum:Amount
php pivot.php data.csv Type,Description sum:Amount
";