Skip to content

Instantly share code, notes, and snippets.

@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active April 25, 2024 17:23
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@invictus-ir
invictus-ir / CloudTrail.csv
Last active April 25, 2024 17:23
An overview of CloudTrail events that are interesting from an Incident Response perspective
We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 10 columns, instead of 9. in line 7.
"Initial Access","Execution","Persistence","Privilege Escalation","Defense Evasion","Credential Access","Discovery","Lateral Movement","Exfiltration","Impact"
ConsoleLogin,StartInstance,CreateAccessKey,CreateGroup,StopLogging,GetSecretValue,ListUsers,AssumeRole,CreateSnapShot,PutBucketVersioning
PasswordRecoveryRequested,StartInstances,CreateUser,CreateRole,DeleteTrail,GetPasswordData,ListRoles,SwitchRole,ModifySnapshotAttributes ,RunInstances
,Invoke,CreateNetworkAclEntry,UpdateAccessKey,UpdateTrail,RequestCertificate,ListIdentities,,ModifyImageAttribute,DeleteAccountPublicAccessBlock
,SendCommand,CreateRoute,PutGroupPolicy,PutEventSelectors,UpdateAssumeRolePolicy,ListAccessKeys,,SharedSnapshotCopyInitiated,
,,CreateLoginProfile,PutRolePolicy,DeleteFlowLogs,,ListServiceQuotas,,SharedSnapshotVolumeCreated,
,,AuthorizeSecurityGroupEgress,PutUserPolicy,DeleteDetector,,ListInstanceProfiles,,ModifyDBSnapshotAttribute,
,,AuthorizeSecurityGroupIngress,AddRoleToInstanceProfile,DeleteMembers,,ListBuckets,,PutBucketP
@ivanskodje
ivanskodje / youtube-dl-download-youtube-music-playlists.md
Last active April 25, 2024 17:23
youtube-dl for downloading music from YouTube

Downloading Music Playlists from YouTube

Disclaimer

Use this knowledge at your own risk.

youtube-dl for Windows

youtube-dl will allow you to download entire youtube playlists and store them as MP3s. This will also allow you to download individual MP3s.

@pH-7
pH-7 / fonts-coding-vs-code.md
Created April 25, 2024 17:22
My favorite fonts for convenient coding on VS Code

Best fonts for your IDE

  1. Space Mono (my favorite one)
  2. Fira Code
  3. MonoLisa
  4. Inconsolata
  5. Apercu Mono
  6. Input Mono
  7. Gintronic
@pH-7
pH-7 / get-mac-finder-preferences.md
Last active April 25, 2024 17:23
Copy Mac Finder preferences to another Mac

Apple's iCloud isn't able to sync the Finder preferences. However, you can copy/paste the following two plist files to your new Mac.

Copy the following two files to your other Mac computer

~/Library/Preferences/com.apple.dock.plist
~/Library/Preferences/com.apple.finder.plist
@ashutoshkrris
ashutoshkrris / YouTube_Playlist_Downloader.md
Last active April 25, 2024 17:23
Download all videos from YouTube Playlist in all supported resolutions (including 1080p and 4K)
  • Using this script, you can download all the videos from a YouTube Playlist in all supported resolutions (including 1080p and 2160p).
  • Enter the playlist url and the resolution you wish to download.
  • Make sure you have ffmpeg setup on your machine. Check the tutorial for the setup guide.
  • You can download the videos in the following resolutions: 144p, 240p, 360p, 480p, 720p, 1080p, 1440p, 2160p
  • Check the video for available resolutions.
@mediafinger
mediafinger / single_page_rails_app.ru
Created April 25, 2024 17:15
Single Page Rails App example / template
# filename: single_page_rails_app.ru
# RUN via: `rackup single_page_rails_app.ru`
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
gem "rack", "2.2.9"
gem "rails", "~> 7.1"
@ygotthilf
ygotthilf / jwtRS256.sh
Last active April 25, 2024 17:19
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@SzymonPobiega
SzymonPobiega / gist:5220595
Last active April 25, 2024 17:19
DDD/CQRS/ES/Architecture videos

If you have two days to learn the very basics of modelling, Domain-Driven Design, CQRS and Event Sourcing, here's what you should do:

In the evenings read the [Domain-Driven Design Quickly Minibook]{http://www.infoq.com/minibooks/domain-driven-design-quickly}. During the day watch following great videos (in this order):

  1. Eric Evans' [What I've learned about DDD since the book]{http://www.infoq.com/presentations/ddd-eric-evans}
  2. Eric Evans' [Strategic Design - Responsibility Traps]{http://www.infoq.com/presentations/design-strategic-eric-evans}
  3. Udi Dahan's [Avoid a Failed SOA: Business & Autonomous Components to the Rescue]{http://www.infoq.com/presentations/SOA-Business-Autonomous-Components}
  4. Udi Dahan's [Command-Query Responsibility Segregation]{http://www.infoq.com/presentations/Command-Query-Responsibility-Segregation}
  5. Greg Young's [Unshackle Your Domain]{http://www.infoq.com/presentations/greg-young-unshackle-qcon08}
  6. Eric Evans' [Acknowledging CAP at the Root -- in the Domain Model]{ht
@CMCDragonkai
CMCDragonkai / http_streaming.md
Last active April 25, 2024 17:19
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on