Skip to content

Instantly share code, notes, and snippets.

@rutcreate
rutcreate / README.md
Last active May 6, 2024 11:45
Install Python 3.10.x on Ubuntu 20.04

Prerequisite

sudo apt update
sudo apt install software-properties-common -y

Add custom APT repository

@EdCharbeneau
EdCharbeneau / Enable-Transformations.md
Last active May 6, 2024 11:44
How to enable transformations on build with Visual Studio

#Transform web.config on build

  1. Unload the project
  2. Edit .csproj
  3. Append figure 1 to the end of the file just before </Project>; v12.0 my change depending on your version of Visual Studio
  4. Save .csproj and reload
  5. Open configuration manager
  6. Add a new Configuration Name: Base. Copy settings from: Release
  7. Copy the contents of your web.config
  8. Right click Web.Config > Add Config Transformation
@wojteklu
wojteklu / clean_code.md
Last active May 6, 2024 11:43
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@tobek
tobek / get-image-urls.js
Last active May 6, 2024 11:42
Save images from chrome inspector/dev tools network tab
/* open up chrome dev tools (Menu > More tools > Developer tools)
* go to network tab, refresh the page, wait for images to load (on some sites you may have to scroll down to the images for them to start loading)
* right click/ctrl click on any entry in the network log, select Copy > Copy All as HAR
* open up JS console and enter: var har = [paste]
* (pasting could take a while if there's a lot of requests)
* paste the following JS code into the console
* copy the output, paste into a text file
* open up a terminal in same directory as text file, then: wget -i [that file]
*/
@hoangmirs
hoangmirs / deploy-pm2.md
Last active May 6, 2024 11:42
Deploy pm2 guide

1. Preparing the server

Install git

sudo apt install git-all

Generate Server's SSH public key

ssh-keygen -t rsa -b 4096 -C "deploy"
cat ~/.ssh/id_rsa.pub
@plembo
plembo / ghpwithnamecheap.md
Last active May 6, 2024 11:41
GitHub Pages with Namecheap custom domain

Using GitHub Pages with a custom domain: Namecheap Edition

As often happens, I found the official documentation and forum answers to be "close, but no cigar", and so had to experiment a little to get things working.

The main problem for me was a lack of concrete configuration examples. That's not entirely GitHub's fault: having migrated from Google Domains to Namecheap in the middle of this project, I was once again reminded of how many different ways there are to do things in the name service universe [1].

Although you'd think the simplest setup would be to merely configure for the subdomain case (https://www.example.com), in my experience using the apex domain (https://example.com) instead resulted in fewer complications.

Procedure

So here's my recipe for using a custom domain with GitHub pages where Namecheap is the DNS provider:

@hasmanyguitars
hasmanyguitars / rolling_stone_top_500_albums_2020.csv
Last active May 6, 2024 11:41
The 500 Greatest Albums of All Time - Rolling Stone - 2020
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 3.
Rank,Artist,Album,Info,Description
500,Arcade Fire,Funeral,"Merge, 2004","Loss, love, forced coming-of-age, and fragile generational hope: Arcade Fire’s debut touched on all these themes as it defined the independent rock of the ‘00s. Built on family ties (leader Win Butler, his wife, Régine Chassagne, his brother Will), the Montreal band made symphonic rock that truly rocked, simultaneously outsize and deeply personal, like the best pop. But for all its sad realism, Butler’s is music that still finds solace, and purpose, in communal celebration.
"
499,"Rufus, Chaka Khan",Ask Rufus,"ABC, 1977","Fronted by Chaka Khan, one of soul music’s most combustible singers, Rufus built its mid-Seventies sound on heavy-footed, guitar-slathered funk. But after spending 16 months in the studio working on Ask Rufus, they came out with a record that gave their songs more room to breathe, anticipating the lithe, loose arrangements of Nineties neo-soul. Khan glided through the head-nodding “Everlasting Love” and the twisty-tur
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active May 6, 2024 11:39
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@schacon
schacon / better-git-branch.sh
Created January 13, 2024 18:41
Better Git Branch output
#!/bin/bash
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
NO_COLOR='\033[0m'
BLUE='\033[0;34m'
YELLOW='\033[0;33m'
NO_COLOR='\033[0m'
Encoded Traversal Strings:
../
..\
..\/
%2e%2e%2f
%252e%252e%252f
%c0%ae%c0%ae%c0%af
%uff0e%uff0e%u2215
%uff0e%uff0e%u2216