Skip to content

Instantly share code, notes, and snippets.

## How to hide API keys from github ##
1. If you have already pushed commits with sensitive data, follow this guide to remove the sensitive info while
retaining your commits: https://help.github.com/articles/remove-sensitive-data/
2. In the terminal, create a config.js file and open it up:
touch config.js
atom config.js
@royz
royz / install_mongodb.md
Created January 31, 2021 17:11
Install MongoDb on ec2 and configure authentication for remote access

Install MongoDb on ec2 and configure authentication for remote access

1. Install and start mongo service [official docs]

1.1 Import the public key used by the package management system

wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
@jaames
jaames / astro.config.mjs
Created January 3, 2022 15:14
Injecting global SCSS variables in Astro (https://astro.build), using additionalData and a path alias
import { fileURLToPath } from 'url';
import path, { dirname } from 'path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
export default {
// all the usual config goes here...
@bingzhangdai
bingzhangdai / 9p_virtio.md
Created July 18, 2020 08:13
Set up VirtFS (9p virtio) for sharing files between Guest and Host on Proxmox VE

How-to

  1. On Host(PVE), edit /etc/pve/qemu-server/VMID.conf
args: -fsdev local,security_model=mapped,id=fsdev0,path=/path/to/share -device virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=hostshare

This tells qemu to create a 9pvirtio device exposing the mount_tag hostshare (just a name to identify the mount point). That device is coupled to an fsdev named fsdev0, which specifies which portion of the host filesystem we are sharing, and in which mode.

@BretFisher
BretFisher / cert.sh
Created August 13, 2020 18:45
docker compose with traefik and certs
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
DOMAIN_NAME=$1
openssl req \
-newkey rsa:2048 \
-x509 \
-nodes \
@schnippy
schnippy / drupal8-media-entity-file-url.md
Last active April 24, 2024 19:13
Programmatically get file URL from a media entity entity reference field in Drupal 8

Programmatically get file URL from a media entity reference field in Drupal 8

I have a content type with a media (image) entity reference field (field_thumbnail_image) and I want to grab its file URL. For this, I need to load the media entity, isolate its source object using getSource, then load this source as a file entity so I can make a proper URL.

    // load the media entity from the media entity reference field
    $media_entity = Media::load($entity->field_thumbnail_image->target_id);

    // get the file source value for the media entity
 $source_value = $media_entity->getSource()->getSourceFieldValue($media_entity);
@SheldonWangRJT
SheldonWangRJT / Convert .mov or .MP4 to .gif.md
Last active April 24, 2024 19:11
Convert Movie(.mov) file to Gif(.gif) file in one command line in Mac Terminal

This notes is written by Sheldon. You can find me with #iOSBySheldon in Github, Youtube, Facebook, etc.

Need

Convert .mov/.MP4 to .gif

Reason

As a developer, I feel better to upload a short video when I create the pull request to show other viewers what I did in this PR. I tried .mov format directly got after finishing recording screen using Quicktime, however, gif offers preview in most web pages, and has smaller file size.

This is not limited to developer, anyone has this need can use this method to convert the files.

@quangIO
quangIO / wezterm.lua
Created March 15, 2022 15:08
My wezterm config with tmux-like bindings
local wezterm = require 'wezterm';
return {
color_scheme = "Dracula",
-- colors = {
-- background = "#0c0e14",
-- },
window_decorations = "NONE",
font = wezterm.font("Iosevka"),
font_size = 10.0,
-- dpi = 192.0,
#AwayFromKeyboardRev9#
{"version":1,"profile":{"commands":[{"path":"\/sys\/devices\/system\/cpu\/cpu3\/onlinechmod644","command":"chmod 644 \/sys\/devices\/system\/cpu\/cpu3\/online"},{"path":"\/sys\/devices\/system\/cpu\/cpu3\/online","command":"echo '1' > \/sys\/devices\/system\/cpu\/cpu3\/online"},{"path":"\/sys\/devices\/system\/cpu\/cpu3\/onlinechmod444","command":"chmod 444 \/sys\/devices\/system\/cpu\/cpu3\/online"},{"path":"\/sys\/devices\/system\/cpu\/cpu4\/onlinechmod644","command":"chmod 644 \/sys\/devices\/system\/cpu\/cpu4\/online"},{"path":"\/sys\/devices\/system\/cpu\/cpu4\/online","command":"echo '1' > \/sys\/devices\/system\/cpu\/cpu4\/online"},{"path":"\/sys\/devices\/system\/cpu\/cpu4\/onlinechmod444","command":"chmod 444 \/sys\/devices\/system\/cpu\/cpu4\/online"},{"path":"\/sys\/module\/workqueue\/parameters\/power_efficientchmod","command":"chmod 644 \/sys\/module\/workqueue\/parameters\/power_efficient"},{"path":"\/sys\/module\/workqueue\/parameters\/power_efficient","command":"echo 'N
@disler
disler / ADA_v2_README.md
Created April 17, 2024 18:01
Personal AI Assistant: 'Ada' - v0.2

This is not working complete code.

This is strictly a v0.2, scrapy, proof of concept version of a personal AI Assistant working end to end in just ~726 LOC.

This is the second iteration showcasing the two-way prompt aka multi-step human in the loop. The initial, v0, assistant version is here.

It's only a frame of reference for you to consume the core ideas of how to build a POC of a personal AI Assistant.

To see the high level of how this works check out the explanation video. To follow our agentic journey check out the @IndyDevDan channel.