Skip to content

Instantly share code, notes, and snippets.

@iamjarvo
iamjarvo / check.go
Created May 3, 2024 22:20 — forked from mattes/check.go
Check if file or directory exists in Golang
if _, err := os.Stat("/path/to/whatever"); os.IsNotExist(err) {
// path/to/whatever does not exist
}
if _, err := os.Stat("/path/to/whatever"); !os.IsNotExist(err) {
// path/to/whatever exists
}
@iamjarvo
iamjarvo / rds-create-db-user-example.sql
Created March 21, 2024 01:19 — forked from sgdan/rds-create-db-user-example.sql
Create database and user login for AWS SQL Server RDS database
/*
Example for AWS SQL Server RDS instance:
- create database
- create login with basic permissions
Since RDS is managed there are some restrictions when creating users and assigning
permissions. This procedure shows how to create a database and login with combinations
of ddl, read and write permissions.
*/
create procedure #createdbuser (
@iamjarvo
iamjarvo / tcp_flags.txt
Created February 1, 2024 16:18 — forked from tuxfight3r/tcp_flags.txt
tcpdump - reading tcp flags
##TCP FLAGS##
Unskilled Attackers Pester Real Security Folks
==============================================
TCPDUMP FLAGS
Unskilled = URG = (Not Displayed in Flag Field, Displayed elsewhere)
Attackers = ACK = (Not Displayed in Flag Field, Displayed elsewhere)
Pester = PSH = [P] (Push Data)
Real = RST = [R] (Reset Connection)
Security = SYN = [S] (Start Connection)
@iamjarvo
iamjarvo / gist:e572ab8a032179d465b99ee62e5eb883
Created October 14, 2022 03:58 — forked from telent/gist:9742059
12 factor app configuration vs leaking environment variables
App configuration in environment variables: for and against
For (some of these as per the 12 factor principles)
1) they are are easy to change between deploys without changing any code
2) unlike config files, there is little chance of them being checked
into the code repo accidentally
3) unlike custom config files, or other config mechanisms such as Java
@iamjarvo
iamjarvo / iterm2.md
Created May 6, 2021 00:10 — forked from squarism/iterm2.md
iterm2 cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
@iamjarvo
iamjarvo / generate-ssh-key.sh
Created February 18, 2021 04:34 — forked from grenade/01-generate-ed25519-ssh-key.sh
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/mozilla_rsa
;; When executed, this file will run a basic web server
;; on http://localhost:8080 that will display the text
;; 'Hello World'.
(ns ring.example.hello-world-2
(:use ring.util.response
ring.adapter.jetty))
(defn handler [request]
(-> (response "Hello World")
;; When executed, this file will run a basic web server
;; on http://localhost:8080 that will display the text
;; 'Hello World'.
(ns ring.example.hello-world-2
(:use ring.util.response
ring.adapter.jetty))
(defn handler [request]
(-> (response "Hello World")
@iamjarvo
iamjarvo / amazon.md
Created November 24, 2020 01:19 — forked from terabyte/amazon.md
Amazon's Build System

Prologue

I wrote this answer on stackexchange, here: https://stackoverflow.com/posts/12597919/

It was wrongly deleted for containing "proprietary information" years later. I think that's bullshit so I am posting it here. Come at me.

The Question

Amazon is a SOA system with 100s of services (or so says Amazon Chief Technology Officer Werner Vogels). How do they handle build and release?

@iamjarvo
iamjarvo / Tuto.md
Created October 23, 2020 05:04 — forked from yogsototh/Tuto.md
Starting Emacs in GUI with shell environment variables correctly set

Problem

When starting Emacs.app on Mac, the Emacs doesn't have some environment variable set correctly. Typically it is terrible when you use GPG, pinentry-mac, gpg-agent But also a lot of different variables used to make git works correctly, etc...

Solution

  1. Create the file ~/bin/init-app-env.sh: