Skip to content

Instantly share code, notes, and snippets.

Avatar
🕶️
Working on @slab, @sturama & @gdg-x

Sheharyar Naseer sheharyarn

🕶️
Working on @slab, @sturama & @gdg-x
View GitHub Profile
@sheharyarn
sheharyarn / gmail-recruiter-reply.appscript.js.gs
Last active Jul 23, 2020
Google Appscript to auto-reply to recruiters
View gmail-recruiter-reply.appscript.js.gs
function respondToEmails() {
//var filter = 'from:(some.email@address.com) AND -label:"Auto-Replied"';
var filter = 'label:"Job Proposals" AND -label:"Auto-Replied"';
var completeLabel = GmailApp.getUserLabelByName("Auto-Replied");
var threads = GmailApp.search(filter);
var replyFrom = "Recruiter Bot <your.email+recruiterbot@gmail.com>";
val realEmail = "your.real@email.com"
var formLink = "https://link.to/your/form"
var response = (
@sheharyarn
sheharyarn / localdev.nginx.conf
Created May 8, 2020
Multi subdomain local website Nginx config
View localdev.nginx.conf
# Dev Local Conf for multiple subdomain websites
# Here `appdev.com` is pointing to 127.0.0.1
#resolver 127.0.0.11 valid=5s; # for docker
ssl_certificate /usr/local/etc/nginx/ssl/app.server.crt;
ssl_certificate_key /usr/local/etc/nginx/ssl/app.server.key;
upstream app_backend { server localhost:4000; }
upstream app_website { server localhost:5001; }
@sheharyarn
sheharyarn / twitter_deleter.ex
Last active Apr 15, 2020
Delete all of your tweets before a certain date
View twitter_deleter.ex
defmodule TwitterDeleter do
@tweet_data Path.expand("~/Downloads/twitterdump/assets/tweet.js")
@cutoff Date.from_iso8601!("2015-01-01")
@call_limit 3000
@chunk_no 3
require Logger
def run do
file = File.read!(@tweet_data)
@sheharyarn
sheharyarn / .dockerignore
Created Apr 15, 2020
Dockerignore for Elixir / Phoenix applications
View .dockerignore
# Elixir Artifacts
/_build/
/deps/
/doc/
/cover/
/.fetch
*.ez
APPNAME-*.tar
erl_crash.dump
@sheharyarn
sheharyarn / simple-elixir-app.dockerfile
Last active Apr 15, 2020
Minimal Dockerfile for simple Elixir applications
View simple-elixir-app.dockerfile
# Build the release
# -----------------
FROM elixir:1.9.0-alpine as build
ENV MIX_ENV=prod
WORKDIR /source
RUN mix local.hex --force && mix local.rebar --force
# Cache dependencies
@sheharyarn
sheharyarn / app-context.js
Last active May 12, 2021
Custom Wrapper around React Contexts
View app-context.js
/**
* Custom Implementation of React Context to manage
* global application state
*
* @author Sheharyar Naseer (@sheharyarn)
* @license MIT
*
* Normal Usage:
*
* ```
@sheharyarn
sheharyarn / flatten.exs
Created Sep 3, 2018
Flatten a List in Elixir (Custom Implementation)
View flatten.exs
defmodule Flatten do
@doc """
Flattens a List in Elixir
## Examples
```
Flatten.flatten([1,2,3,4])
# => [1,2,3,4]
@sheharyarn
sheharyarn / memoize.ex
Last active Sep 27, 2020
Simple Memoization in Elixir (using FastGlobal)
View memoize.ex
defmodule Memoize do
@moduledoc """
Simple memoization helper built on top of FastGlobal.
Remember to add `{:fastglobal, "~> 1.0"}` to your
dependencies first.
## Usage
@sheharyarn
sheharyarn / reddup_video_controls.js
Created Mar 11, 2018
Reddup video controls script for GreaseMonkey / Tampermonkey
View reddup_video_controls.js
// ==UserScript==
// @name Reddup Video Controls
// @version 0.1.0
// @namespace https://www.reddup.co/
// @homepageURL https://sheharyar.me/
// @author Sheharyar Naseer
// @description Show Video Controls for all videos on Reddup
// @include http*://www.reddup.co/*
// @license MIT
// ==/UserScript==
@sheharyarn
sheharyarn / bitcoin.conf
Last active Mar 2, 2018
Quickly work with BTC Testnet
View bitcoin.conf
testnet=1
server=1
# enable SSL for RPC server
#rpcssl=1
rpcallowip=0.0.0.0/0
rpcuser=admin
rpcpassword=123