Skip to content

Instantly share code, notes, and snippets.

View niksmac's full-sized avatar
🇮🇳
🧜 Merperson

Nikhil M niksmac

🇮🇳
🧜 Merperson
View GitHub Profile
@niksmac
niksmac / iptables.md
Last active April 25, 2022 05:07
Persist iptables even after reboot Ubuntu

Set the rules

sudo iptables -A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT
sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3000

On Ubuntu: sudo apt-get install iptables-persistent

@rtfpessoa
rtfpessoa / nextdns.js
Last active January 14, 2024 02:05
nextdns.io Block Youtube Ads
// ID of the config, e.g. A1234BCD.
const configID = "A1234BCD";
// API key, found at the bottom of your account page in https://my.nextdns.io/account
const APIKey = "xxxxxxxxxxxxxxxxxxxxxxxxxx";
// Mark true or false. If true, failed links will be retried 3 times at progressively increasing intervals.
// If false, failed links will not be retried.
const retryFailedLinks = true;
// Time delay between requests in milliseconds.
// 800 seems to not give any errors but is rather slow while anything faster will give errors (in limited testing).
// If you want to go lower, it is recommended that "retryFailedLinks" is true
@tannerlinsley
tannerlinsley / README.md
Last active April 12, 2024 17:04
Replacing Create React App with the Next.js CLI

Replacing Create React App with the Next.js CLI

How dare you make a jab at Create React App!?

Firstly, Create React App is good. But it's a very rigid CLI, primarily designed for projects that require very little to no configuration. This makes it great for beginners and simple projects but unfortunately, this means that it's pretty non-extensible. Despite the involvement from big names and a ton of great devs, it has left me wanting a much better developer experience with a lot more polish when it comes to hot reloading, babel configuration, webpack configuration, etc. It's definitely simple and good, but not amazing.

Now, compare that experience to Next.js which for starters has a much larger team behind it provided by a world-class company (Vercel) who are all financially dedicated to making it the best DX you could imagine to build any React application. Next.js is the 💣-diggity. It has amazing docs, great support, can grow with your requirements into SSR or static site generation, etc.

So why

@sreez
sreez / gist:c624b3e440b66f9d16a9dc39a2297ed1
Created March 6, 2020 12:36
taiwindcss default list of padding , font size and line height against equivalent pixels for font base 16px
0px 0rem .p-0
4px 0.25rem .p-1
8px 0.5rem .p-2
12px 0.75rem .p-3, .leading-3, .text-xs
14px 0.875rem .text-sm
16px 1rem .p-4, .leading-4, .text-base
18px 1.125rem .text-lg
20px 1.25rem .p-5, .leading-5, .text-xl
24px 1.5rem .p-6, .leading-6, .text-2xl
28px 1.75rem .leading-7
@nzvtrk
nzvtrk / axiosInterceptor.js
Last active December 7, 2023 17:21
Axios create/recreate cookie session in node.js enviroment
/* Basic example of saving cookie using axios in node.js and session's recreation after expiration.
* We have to getting/saving cookie manually because WithCredential axios param use XHR and doesn't work in node.js
* Also, this example supports parallel request and send only one create session request.
* */
const BASE_URL = "https://google.com";
// Init instance of axios which works with BASE_URL
const axiosInstance = axios.create({ baseURL: BASE_URL });
@robsonsobral
robsonsobral / _headers
Last active August 10, 2023 21:08
Netlify headers
/*
# Only connect to this site and subdomains via HTTPS for the next one year
Strict-Transport-Security: max-age=31536000; includeSubDomains
# Block site from being framed with X-Frame-Options and CSP
Content-Security-Policy: frame-ancestors 'self'
# X-Frame-Options tells the browser whether you want to allow your site to be framed or not. By preventing a browser from framing your site you can defend against attacks like clickjacking.
X-Frame-Options: SAMEORIGIN
@pstehlik
pstehlik / ipfs_install.sh
Created February 4, 2018 22:36
Install IPFS on Ubuntu 16.04 64bit and set up as systemd service
#!/bin/bash
#pick your IPFS version
VERS=0.4.13
DIST="go-ipfs_v${VERS}_linux-amd64.tar.gz"
sudo apt-get update
sudo apt-get install golang-go -y
wget https://dist.ipfs.io/go-ipfs/v0.4.13/$DIST
tar xvfz $DIST

Meltdown fix impact on Redis performances in virtualized environments

UPDATE: apparently kernel difference may have a serious impact, so I'll redo the test from scratch.

Test performed with AOF enabled, fsync policy 1 second, allowing the rewrites to be triggered.

Command lines used:

@hofmannsven
hofmannsven / README.md
Created December 6, 2017 00:32
Increase key repeat rate on macOS

Increase key repeat rate on macOS

Settings: System Preferences » Keyboard » Key Repeat/Delay Until Repeat

Use the commands below to increase the key repeat rate on macOS beyond the possible settings via the user interface. The changes aren't applied until you restart your computer.

Source: https://apple.stackexchange.com/a/83923

@kylealwyn
kylealwyn / app-store-icons.html
Last active August 27, 2018 16:20
Get It On App Store SVG
<!-- Apple App Store -->
<svg version="1.1" class="download-btn" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="-237.1 377.9 133.1 38.2" enable-background="new -237.1 377.9 133.1 38.2" role="img" aria-label="Download on the Apple store" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve">
<g fill="currentColor">
<path d="M-157.1,389.6c0.2-0.1,0.3-0.3,0.4-0.6c0-0.1,0-0.1,0-0.2v-0.7c-1.2,0-1.7,0.3-1.7,1c0,0.2,0.1,0.4,0.2,0.6
s0.3,0.2,0.5,0.2C-157.5,389.8-157.3,389.7-157.1,389.6z"></path>
<path d="M-167,400.4c-0.5,0-1,0.2-1.4,0.5c-0.4,0.3-0.7,0.8-0.8,1.4c-0.1,0.3-0.1,0.5-0.1,0.6v1.6c0,0.7,0.2,1.3,0.6,1.8
c0.4,0.5,1,0.7,1.7,0.7c0.8,0,1.4-0.3,1.9-0.9c0.4-0.6,0.7-1.4,0.7-2.4c0-0.9-0.2-1.7-0.6-2.3C-165.6,400.7-166.2,400.4-167,400.4z
"></path>
<path d="M-163,386.4c-0.4,0-0.7,0.2-1,0.6c-0.2,0.3-0.3,0.7-0.3,1.1c0,0.4,0.1,0.8,0.3,1.1c0.2,0.4,0.5,0.6,1,0.6
c0.4,0,0.7-0.2,0.9-0.6c0.2-0.3,0.3-0.7,0.3-1.1s-0.1-0.8-0.3-1.1C-162.3,386.6-162.6,386.4-163,386.4z"></p