Skip to content

Instantly share code, notes, and snippets.

@nemani
nemani / download_all_lambda_functions.sh
Last active May 21, 2024 16:29
Download All Lambda Functions
# Parallelly download all aws-lambda functions
# Assumes you have ran `aws configure` and have output-mode as "text"
# Works with "aws-cli/1.16.72 Python/3.6.7 Linux/4.15.0-42-generic botocore/1.12.62"
download_code () {
local OUTPUT=$1
aws lambda get-function --function-name $OUTPUT --query 'Code.Location' | xargs wget -O ./lambda_functions/$OUTPUT.zip
}
mkdir -p lambda_functions
@kogekiplay
kogekiplay / config.yaml
Last active May 21, 2024 16:28
公开 scp
####################################
# 创建者:v2rayse.com
# 客户端:Clash.Meta
# 创建时间:2023-10-16 11:18:43
# 使用模版:V2RaySE 默认模版
# 节点数量:1
# Stash修改版
####################################
# !!当前配置文件请使用基于 Clash.Meta 内核程序
mixed-port: 7890
@brokenthorn
brokenthorn / SqlDataReader_To_CSV_Using_CsvHelper_Library.cs
Created July 11, 2021 00:29
In this C# Gist, a CsvHelper.CsvWriter is used to asynchronously write the results of a SQL query to a CSV file without worrying about each column's data type.
try
{
await using var sqlDataReader = await sqlCommand.ExecuteReaderAsync(cancellationToken);
await using var streamWriter = new StreamWriter($"{reportName}_{startDate:dd-MM-yyyy}-{endDate:dd-MM-yyyy}.csv");
await using var csvWriter = new CsvWriter(streamWriter, _csvConfiguration);
var columnSchema = sqlDataReader.GetColumnSchema();
var columnCount = columnSchema.Count;
// write headers to CSV:
@pamelafox
pamelafox / solar_system_objects.sql
Last active May 21, 2024 16:25
solar_system_objects.sql
/*
Solar system objects
Adapted from: http://en.wikipedia.org/wiki/List_of_Solar_System_objects_by_size
Collected by: https://www.khanacademy.org/profile/patrick809/programs
*/
CREATE TABLE solar_system_objects(
body TEXT
, mean_radius NUMERIC /* km */
, mean_radius_rel NUMERIC /* relative to earth */
, volume NUMERIC /* 10^9 km^3 */
@dhh
dhh / linux-setup.sh
Last active May 21, 2024 16:24
linux-setup.sh
# CLI
sudo apt update -y
sudo apt install -y \
git curl btop \
docker.io docker-buildx \
build-essential pkg-config autoconf bison rustc cargo clang \
libssl-dev libreadline-dev zlib1g-dev libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev libjemalloc2 \
libvips imagemagick libmagickwand-dev mupdf mupdf-tools \
redis-tools sqlite3 libsqlite3-0 libmysqlclient-dev \
rbenv apache2-utils
@andris9
andris9 / git-cache-meta.sh
Created March 5, 2012 13:15
git-cache-meta
#!/bin/sh -e
#git-cache-meta -- simple file meta data caching and applying.
#Simpler than etckeeper, metastore, setgitperms, etc.
#from http://www.kerneltrap.org/mailarchive/git/2009/1/9/4654694
#modified by n1k
# - save all files metadata not only from other users
# - save numeric uid and gid
# 2012-03-05 - added filetime, andris9
@ayoubzulfiqar
ayoubzulfiqar / folder_structure.md
Created September 5, 2023 06:12
The Folder Structure for Every Golang Project

Go - The Ultimate Folder Structure

Organizing your Go (Golang) project's folder structure can help improve code readability, maintainability, and scalability. While there is no one-size-fits-all structure, here's a common folder structure for a Go project:

project-root/
    ├── cmd/
    │   ├── your-app-name/
    │   │   ├── main.go         # Application entry point
    │   │   └── ...             # Other application-specific files
@rcarrata
rcarrata / regenerate-kubeconfig.sh
Last active May 21, 2024 16:22
Script for regenerating the kubeconfig for system:admin user
#!/bin/bash
AUTH_NAME="auth2kube"
NEW_KUBECONFIG="newkubeconfig"
echo "create a certificate request for system:admin user"
openssl req -new -newkey rsa:4096 -nodes -keyout $AUTH_NAME.key -out $AUTH_NAME.csr -subj "/CN=system:admin"
echo "create signing request resource definition"
@mattiasghodsian
mattiasghodsian / readme.md
Last active May 21, 2024 16:22
Valheim Dedicated Server Setup on Ubuntu 20.04.1 LTS

Port forwarding

Open ports (udp)

2456 2457 2458 27060

Uncomplicated Firewall

sudo ufw allow 2456/udp