Skip to content

Instantly share code, notes, and snippets.

View therohitdas's full-sized avatar

Rohit Das therohitdas

View GitHub Profile
@therohitdas
therohitdas / Extract multiple PDFs with password
Last active January 1, 2024 14:51
Extracts multiple password protected PDFs into a new directory
#!/bin/python3
"""
How to use?
1) pip3 install pikepdf
2) save all pdfs in the same folder as the script
3) run the script using - python3 process.py <pdf_password>
4) all the extracted passwords will be stored in /extracted
"""
@mingalevme
mingalevme / php-redis-custom-flags.sh
Created March 1, 2020 11:46
Installing PHP Redis extension inside PHP-Alpine-based Docker container
NPROC=$(getconf _NPROCESSORS_ONLN)
mkdir -p /usr/src/php/ext
cd /usr/src/php/ext
pecl bundle redis
docker-php-ext-configure redis --enable-redis-igbinary --enable-redis-lzf
docker-php-ext-install -j${NPROC} redis
cd -
@bradtraversy
bradtraversy / node_nginx_ssl.md
Last active April 30, 2024 08:44
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@theory-of-soul
theory-of-soul / country2emoji.js
Created July 4, 2019 11:55
Javascript : convert country code to emoji flag by Stan Larroque
// Assume the country_code is a ISO 3166-1 alpha-2 string (eg: "US")
function country2emoji(country_code) {
var OFFSET = 127397;
var cc = country_code.toUpperCase();
function _toConsumableArray(arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {
arr2[i] = arr[i];
}
return arr2;
@Julian-Nash
Julian-Nash / flask_sitemap_generator.py
Last active May 4, 2024 13:03
Flask dynamic sitemap generator
@app.route("/sitemap")
@app.route("/sitemap/")
@app.route("/sitemap.xml")
def sitemap():
"""
Route to dynamically generate a sitemap of your website/application.
lastmod and priority tags omitted on static pages.
lastmod included on dynamic content such as blog posts.
"""
from flask import make_response, request, render_template
@zioproto
zioproto / redis-delete-old-keys.py
Last active March 3, 2023 18:45
Delete Redis Stale Keys
#!/usr/bin/env python
import redis
r = redis.StrictRedis(host='localhost', port=6379, db=0)
# To debug code on a single key you can use this instead of the for loops:
# key = r.randomkey()
# Delete all keys not accessed since 'idletime'
for key in r.scan_iter("*"):
idle = r.object("idletime", key)
@v1c77
v1c77 / route-screen.applescript
Last active April 14, 2024 04:25
rotate display using applescript, tested on Mac os High Sierra(10.13)
--
-- Created by: v1c77
-- Created on: 2018/7/21
--
-- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
-- Version 2, December 2004
-- Copyright (C) 2020 v1c77
-- Everyone is permitted to copy and distribute verbatim or modified
@HoldOffHunger
HoldOffHunger / bradvin.social.share.urls.txt
Last active April 18, 2024 13:41
Social Share URL's (Summary)
https://www.facebook.com/sharer.php?u={url}
https://www.facebook.com/dialog/share?app_id={app_id}&display={page_type}&href={url}&redirect_uri={redirect_url}
https://reddit.com/submit?url={url}&title={title}
https://twitter.com/intent/tweet?url={url}&text={title}&via={user_id}&hashtags={hash_tags}
https://www.linkedin.com/sharing/share-offsite/?url={url}
https://api.whatsapp.com/send?phone={phone_number}&text={title}%20{url}
https://www.tumblr.com/widgets/share/tool?canonicalUrl={url}&title={title}&caption={text}&tags={hash_tags}
http://pinterest.com/pin/create/button/?url={url}
https://www.blogger.com/blog-this.g?u={url}&n={title}&t={text}
https://www.evernote.com/clip.action?url={url}&title={title}
@g105b
g105b / curlpool.sh
Last active March 11, 2024 06:17
Pool 100 parallel curl requests at a time
#!/bin/bash
target=${1:-http://example.com}
while true # loop forever, until ctrl+c pressed.
do
for i in $(seq 100) # perfrom the inner command 100 times.
do
curl $target > /dev/null & # send out a curl request, the & indicates not to wait for the response.
done
wait # after 100 requests are sent out, wait for their processes to finish before the next iteration.
@meain
meain / loading_messages.js
Last active April 27, 2024 09:54
Funny loading messages
export default [
"Reticulating splines...",
"Generating witty dialog...",
"Swapping time and space...",
"Spinning violently around the y-axis...",
"Tokenizing real life...",
"Bending the spoon...",
"Filtering morale...",
"Don't think of purple hippos...",
"We need a new fuse...",