Skip to content

Instantly share code, notes, and snippets.

View m2sh's full-sized avatar
🤔
hmm!

Mohammad Shahgolzadeh m2sh

🤔
hmm!
View GitHub Profile
@jDmacD
jDmacD / README.MD
Last active March 30, 2023 17:24
Raspberry Pi OS kernel compile for envoy support

These playbooks are for compiling the Pi OS kernel to make it compatible with Envoy which is used under the hood of Cilium, Consul Connect and maybe Istio. Enyoy will refuse to start on Pi OS due to a memory allocation error. Long discussion here. The two options are

  • Building Envoy from source (not fun)
  • Compile the Pi OS kernel with some extra flags (not fun, but doable)
  • Use Ubuntu or maybe Debian built for the Pi (not fun either)

Pi OS needs to be compiled with the following options:

CONFIG_ARM64_VA_BITS_39=n
CONFIG_ARM64_VA_BITS_48=y
CONFIG_ARM64_VA_BITS=48
@aleskxyz
aleskxyz / ssh-tunnel.txt
Last active December 22, 2023 20:30
Tunnel over SSH
You can setup a tunnel over SSH with -w option as below.
Try it at home, not server!
Server side
===========
ip tuntap add mode tun dev tun0
ip addr add 192.168.16.1/30 dev tun0
ip link set tun0 up
iptables -I FORWARD -o tun0 -i <public-interface> -j ACCEPT
iptables -I FORWARD -i tun0 -o <public-interface> -j ACCEPT
@arastu
arastu / current_track.applescript
Last active November 27, 2020 19:52
update twitter bio and add current playing song from Spotify to it
on escape_quotes(string_to_escape)
set AppleScript's text item delimiters to the "\""
set the item_list to every text item of string_to_escape
set AppleScript's text item delimiters to the "\\\""
set string_to_escape to the item_list as string
set AppleScript's text item delimiters to ""
return string_to_escape
end escape_quotes
tell application "Spotify"
@qzm
qzm / aria2.conf
Last active April 11, 2024 01:35
Best aria2 Config
### Basic ###
# The directory to store the downloaded file.
dir=${HOME}/Downloads
# Downloads the URIs listed in FILE.
input-file=${HOME}/.aria2/aria2.session
# Save error/unfinished downloads to FILE on exit.
save-session=${HOME}/.aria2/aria2.session
# Save error/unfinished downloads to a file specified by --save-session option every SEC seconds. If 0 is given, file will be saved only when aria2 exits. Default: 0
save-session-interval=60
# Set the maximum number of parallel downloads for every queue item. See also the --split option. Default: 5
@bmaupin
bmaupin / convert-deploymentconfig-to-deployment.md
Last active November 29, 2023 08:24
Convert OpenShift DeploymentConfig to Kubernetes Deployment
  1. Change apiVersion from:

    - apiVersion: v1

    (or apiVersion: apps.openshift.io/v1)

    to:

@LupusArgentum
LupusArgentum / openwrt-8021x.md
Last active April 3, 2024 20:13
OpenWrt-router as 802.1x-client

OpenWrt-router as 802.1x-client

This use-case is a pretty rare one, but in some circumstances, it can be very helpful. For example when you live in a student dormatory which only offers one 802.1x-encrypted LAN-port in your room, but you want to run your own wifi-network to be online with other clients, too, like your laptop or smartphone. In this case, normal routers with stock firmware won't help you out because most don't support this networking protocol. OpenWrt on the other hand offers you the possibility to connect your router (you could buy this one if you don't already have a suiting router) to the 802.1x-network via WAN and enable you to have an own, independent network. Here's how.

Important: before you attempt to do this, it is NECESSARY to ask your network admin if he/she is okay with your usage scenario. This can cause some trouble if you do it without permission, as many 802.1x-networks aim to prevent this exact use-case.

So here's the deal

@bradtraversy
bradtraversy / mongodb_cheat_sheet.md
Last active April 19, 2024 02:47
MongoDB Cheat Sheet

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@mcfrojd
mcfrojd / Shield_Intents.MD
Last active March 30, 2024 16:53
Working INTENTS to use with Community Hass.io Add-ons: Android Debug Bridge for your Nvidia Shield TV

Latest Update 2021-03-06 : New image showing the new "Services" in Home Assistant and got some tips from the comments below.

Credits and thanks: Home Assistant Forum users & Github users: @ocso, @wiphye, @teachingbirds, @tboyce1, @simbesh, @JeffLIrion @ff12 @rebmemer @siaox @DiederikvandenB @Thebuz @clapbr @Finsterclown


Start apps on your android device (in the examples below, my Nvidia Shield TV) from Home Assistant

alt text

Starts Youtube App

entity_id: media_player.shield
command: >-
@sau-lanvy
sau-lanvy / kubernetes-cluster-using-kubespray.md
Last active January 19, 2024 17:27
Deploy a Production Ready Kubernetes Cluster using Kubespray with Ansible

Deployment Architecture

deployment architecture

System Configuration

  1. All kubernetes nodes: set SELINUX to permissive mode
$ vi /etc/selinux/config
SELINUX=permissive

$ setenforce 0
@ezimuel
ezimuel / static.php
Created July 17, 2018 16:30
Swoole HTTP static file server example
<?php
// Simple HTTP static file server using Swoole
$host = $argv[1] ?? '127.0.0.1';
$port = $argv[2] ?? 9501;
$http = new swoole_http_server($host, $port);
// The usage of enable_static_handler seems to produce errors
// $http->set([