Skip to content

Instantly share code, notes, and snippets.

@daimaou92
daimaou92 / .gitconfig changes
Last active November 20, 2022 12:00
GPG Key Management
Put this in "$HOME/.gitconfig"
[user]
name = Dai Maou
email = [email protected]
signingkey = [email protected]
[commit]
gpgsign = true
@daimaou92
daimaou92 / nginx with forwarded
Last active October 13, 2021 08:00
nginx template with map for Forwarded Header per RFC 7239
map $remote_addr $proxy_forwarded_elem {
# IPv4 addresses can be sent as-is
~^[0-9.]+$ "for=$remote_addr";
# IPv6 addresses need to be bracketed and quoted
~^[0-9A-Fa-f:.]+$ "for=\"[$remote_addr]\"";
# Unix domain socket names cannot be represented in RFC 7239 syntax
default "for=unknown";
}
#!/bin/bash
NUM_SERVERS=$1
if [ -z "$NUM_SERVERS" ]; then
NUM_SERVERS=20
fi
if [ ! -f "/etc/arch-release" ]; then
echo "This script should only run on arch linux"
exit 1
fi
@daimaou92
daimaou92 / xfce4.sh
Created February 4, 2019 17:42
XFCE-4 Arch setup
yay -S xfce4 xfce4-goodies xfce4-volumed-pulse xfce4-sensors-plugin-nvidia libcanberra libcanberra-pulse sound-theme-smooth
@daimaou92
daimaou92 / PostArchInstall.md
Last active October 13, 2021 10:17
Things to do after Installing ArchLinux

Mirrors

sudo pacman -S reflector
sudo reflector --verbose --latest 5 --sort rate --save /etc/pacman.d/mirrorlist
sudo reflector --latest 200 --protocol http --protocol https --sort rate --save /etc/pacman.d/mirrorlist

Paru

@daimaou92
daimaou92 / etc--init.d--mongod
Created December 14, 2018 06:53
Mongo init.d startup script
#!/bin/sh
#
# init.d script with LSB support.
#
# Copyright (c) 2007 Javier Fernandez-Sanguino <[email protected]>
#
# This is free software; you may redistribute it and/or modify
# it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2,
# or (at your option) any later version.
@daimaou92
daimaou92 / nginxTuner.sh
Created October 22, 2018 18:13
Nginx Tuning
echo "2048 64512" | sudo dd of=/proc/sys/net/ipv4/ip_local_port_range
echo "1" | sudo dd of=/proc/sys/net/ipv4/tcp_tw_recycle
echo "1" | sudo dd of=/proc/sys/net/ipv4/tcp_tw_reuse
echo "10" | sudo dd of=/proc/sys/net/ipv4/tcp_fin_timeout
echo "65536" | sudo dd of=/proc/sys/net/core/somaxconn
echo "65536" | sudo dd of=/proc/sys/net/ipv4/tcp_max_syn_backlog
var mr = db.runCommand({"mapreduce": "collName", "map": function(){ for(var key in this){ emit(key, null); } }, "reduce": function(key, stuff){ return null; }, "out": "collName"+ "_keys" })
db[mr.result].distinct("_id")
[Unit]
Description=Kafka
Requires=zookeeper.service
After=zookeeper.service
[Service]
Type=simple
ExecStart=/bin/sh -c '/home/ubuntu/.kafka/bin/kafka-server-start.sh /home/ubuntu/.kafka/config/server.properties > /home/ubuntu/.kafka/kafka.log 2>&1'
ExecStop=/home/ubuntu/.kafka/bin/kafka-server-stop.sh
Restart=on-abnormal
@daimaou92
daimaou92 / postman_install.sh
Created September 20, 2018 04:49 — forked from ironbyte/postman_install.sh
Postman install Ubuntu 18.04
#!/bin/bash
# Get postman app
wget https://dl.pstmn.io/download/latest/linux64 -O postman.tar.gz
sudo tar -xzf postman.tar.gz -C /opt
sudo ln -s /opt/Postman/Postman /usr/bin/postman
#Create a Desktop Entry
cat > ~/.local/share/applications/postman.desktop <<EOL
[Desktop Entry]
Encoding=UTF-8