Skip to content

Instantly share code, notes, and snippets.

@wych42
wych42 / clash.service
Last active February 5, 2024 05:39
Clash as transparent proxy(not totally transparent) on gateway box
[Unit]
Description=Clash service
After=network.target
[Service]
[Service]
Type=simple
StandardError=journal
User=clash
@lbernail
lbernail / ebsnvme-id
Created April 26, 2018 15:07
ebsnvme-id script
#!/usr/bin/env python2.7
# Copyright (C) 2017 Amazon.com, Inc. or its affiliates.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
@jakobii
jakobii / HTTPServer.ps1
Last active April 5, 2023 08:37
A Basic Powershell Webserver
# You Should be able to Copy and Paste this into a powershell terminal and it should just work.
# To end the loop you have to kill the powershell terminal. ctrl-c wont work :/
# Http Server
$http = [System.Net.HttpListener]::new()
# Hostname and port to listen on
$http.Prefixes.Add("http://localhost:8080/")
@nepsilon
nepsilon / auto-backup-your-configuration-files-with-vim.md
Last active March 29, 2024 09:26
Auto-backup your configuration files with Vim — First published in fullweb.io issue #71

Auto-backup your configuration files with Vim

Not using versioning on your configuration files and editing them with Vim?

Use Vim’s backup option to automatically keep a copy of past versions. To put in your ~/.vimrc:

"Turn on backup option
set backup
@nepsilon
nepsilon / pg-backup.md
Last active November 21, 2017 00:27
Proper way to do backup (and restore!) with PostgreSQL 🐘 — First published in fullweb.io issue #51

Proper way to do backup (and restore!) with PostgreSQL 🐘

Postgres provides us several options to do backup just like we want. I’ve tried several strategies in the past, and here is the one I stick to now, for both its simplicity and efficiency.

Backup your database with:

# This is using Postgres custom format
pg_dump -Fc dbname > filename
@evanwill
evanwill / gitBash_windows.md
Last active April 17, 2024 08:53
how to add more utilities to git bash for windows, wget, make

How to add more to Git Bash on Windows

Git for Windows comes bundled with the "Git Bash" terminal which is incredibly handy for unix-like commands on a windows machine. It is missing a few standard linux utilities, but it is easy to add ones that have a windows binary available.

The basic idea is that C:\Program Files\Git\mingw64\ is your / directory according to Git Bash (note: depending on how you installed it, the directory might be different. from the start menu, right click on the Git Bash icon and open file location. It might be something like C:\Users\name\AppData\Local\Programs\Git, the mingw64 in this directory is your root. Find it by using pwd -W). If you go to that directory, you will find the typical linux root folder structure (bin, etc, lib and so on).

If you are missing a utility, such as wget, track down a binary for windows and copy the files to the corresponding directories. Sometimes the windows binary have funny prefixes, so

@dims
dims / Dockerfile
Last active May 10, 2022 21:48
Experiment with Kubernetes with a custom Docker Image
FROM python:3
EXPOSE 8000
CMD ["python", "-m", "http.server"]
@nepsilon
nepsilon / how-to-ssh-agent.md
Last active December 7, 2023 20:21
Remember passphrases with ssh-agent — First published in fullweb.io issue #31

How to use ssh-agent to cache your SSH credentials?

Contributed by Fabien Loudet, Linux SysAdmin at Rosetta Stone

Tired of always having to enter your SSH key passphrase when logging in to remote machines? Here comes ssh-agent. Enter the passphrase once and it will keep it in memory for you

Using ssh-agent in your shell session:

@ygotthilf
ygotthilf / jwtRS256.sh
Last active April 17, 2024 04:10
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
@kwilczynski
kwilczynski / check.md
Last active July 6, 2023 08:35
Recipe / Role check in Chef

If you want to check whether a node run_list includes a specific role (upon expansion), then you could use role? method on the Node object:

node.role?('name')

Alternatively, you can see whether either would work for you:

node.roles.include?('name')

node.run_list?('role[name]')