Skip to content

Instantly share code, notes, and snippets.

View channaveer's full-sized avatar

Channaveer Hakari channaveer

View GitHub Profile
@channaveer
channaveer / aws_autoscaling_cron.rb
Created October 2, 2023 01:06 — forked from kixorz/aws_autoscaling_cron.rb
Running cron jobs in AWS Auto Scaling group is tricky. When you deploy the same code and configuration to all instances in the group, cron job would run on all of them. You may not want that. This script detects the first instance in the group and allows only this instance to run the job. IAM user used by this script needs to have permissions to…
#!/usr/bin/env ruby
require 'syslog'
require 'net/http'
require 'aws-sdk'
Syslog.open
AWS.config({
:access_key_id => '<iam user key>',
:secret_access_key => '<iam user secret>'
@channaveer
channaveer / wireguard.conf
Created May 3, 2023 12:29 — forked from nealfennimore/wireguard.conf
Wireguard VPN - Forward all traffic to server
# ------------------------------------------------
# Config files are located in /etc/wireguard/wg0
# ------------------------------------------------
# ---------- Server Config ----------
[Interface]
Address = 10.10.0.1/24 # IPV4 CIDR
Address = fd86:ea04:1111::1/64 # IPV6 CIDR
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE # Add forwarding when VPN is started
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; ip6tables -D FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE # Remove forwarding when VPN is shutdown
@channaveer
channaveer / System Design.md
Created February 8, 2023 23:32 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@channaveer
channaveer / WireGuard_Setup.txt
Created January 30, 2023 13:19 — forked from chrisswanda/WireGuard_Setup.txt
Stupid simple setting up WireGuard - Server and multiple peers
Install WireGuard via whatever package manager you use. For me, I use apt.
$ sudo add-apt-repository ppa:wireguard/wireguard
$ sudo apt-get update
$ sudo apt-get install wireguard
MacOS
$ brew install wireguard-tools
Generate key your key pairs. The key pairs are just that, key pairs. They can be
@channaveer
channaveer / README.md
Created April 5, 2021 14:22 — forked from oodavid/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@channaveer
channaveer / Test Driven Laravel from Scratch.md
Created September 16, 2020 13:47 — forked from Pen-y-Fan/Test Driven Laravel from Scratch.md
Test Driven Laravel from Scratch by Adam Wathan

Test Driven Laravel from Scratch

https://vimeo.com/151390908 by Adam Wathan 26 min ~2015.

One of the biggest hurdles in getting started with test driven development with a brand new application is knowing exactly what test to write first. In this screencast, I walk through using outside-in TDD to drive out a feature from scratch in a brand new untouched Laravel application.

Notes & disclaimer

  • The purpose of these notes are to follow the above tutorial, making detailed notes of each step.
@channaveer
channaveer / pdf-invoice.html
Last active December 19, 2022 19:03
Invoice Sample HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Some Random Title</title>
<style>
body{
@channaveer
channaveer / deployment_guide.md
Created April 3, 2020 20:50 — forked from vicgonvt/deployment_guide.md
Deployment Guide for Ubuntu Server from Scratch with Laravel
@channaveer
channaveer / gist:23a4f3966f1343aa2a54646665d1749a
Created December 13, 2019 06:33
Responsive Design Startup
html {
line-height: 1.15;
-webkit-text-size-adjust: 100%;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
body {
margin: 0;
padding: 0;
font-size: 14px;
@channaveer
channaveer / bradvin.social.share.urls.txt
Last active August 18, 2019 20:16 — forked from HoldOffHunger/bradvin.social.share.urls.txt
Social Share URL's (Summary)
https://wa.me/{phone_number}/?text={urlencodedtext}
http://compose.mail.yahoo.com/?to={email_address}&subject={title}&body={url}
http://digg.com/submit?url={url}
http://pinterest.com/pin/create/link/?url={url}
http://service.weibo.com/share/share.php?url={url}&appkey=&title={title}&pic=&ralateUid=
http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url={url}
http://surfingbird.ru/share?url={url}&description={text}&screenshot={image}&title={title}
http://vk.com/share.php?url={url}&title={title}&comment={text}
http://widget.renren.com/dialog/share?resourceUrl={url}&srcUrl={url}&title={title}&description={text}
http://www.addthis.com/bookmark.php?url={url}