Skip to content

Instantly share code, notes, and snippets.

View vinodMS's full-sized avatar
🎯
Focusing

Vinod Sudharshan vinodMS

🎯
Focusing
  • Amsterdam, Netharlands
View GitHub Profile
@JustThomas
JustThomas / nginx_remove_double_slashes.md
Created February 4, 2018 17:16
nginx: Remove double slashes from URLs

Put the following directives in your server block. nginx will then redirect URLs with double (or triple or multiple) slashes to the corresponding URL with a single slash.

merge_slashes off;
rewrite ^(.*?)//+(.*?)$ $1/$2 permanent;
<template>
<div class="container main">
<section class="section">
<article class="message">
<div class="message-header is-info">
<p>Register Form</p>
</div>
<div class="message-body">
<form ref="form" @submit.prevent="onSubmit">
<b-field
@roliveira
roliveira / collate.py
Last active October 8, 2020 20:41
Crop, split and collate PDFs using pyPdf
import argparse
from pyPdf import PdfFileWriter, PdfFileReader
def create_parsers():
p = argparse.ArgumentParser(
prog='crop',
description='"%(prog)s" crop pdfs',
@bwbaugh
bwbaugh / ec2-ubuntu-16.04-swap.md
Last active September 27, 2019 06:27
EC2 swap file instructions. Gathered from several online articles / blogs / stackexchange.

Can check if you're using swap with sudo swapon --show and free -h.

EBS volume

Useful for t2.micro and other instances with no access to instance store. Use this if you prefer not to mess with the root volume.

  1. Create the EBS volume e.g., 1 GB.
@dmyersturnbull
dmyersturnbull / groupyby_parallel.py
Last active February 6, 2024 00:43
Performs a Pandas groupby operation in parallel
import pandas as pd
import itertools
import time
import multiprocessing
from typing import Callable, Tuple, Union
def groupby_parallel(
groupby_df: pd.core.groupby.DataFrameGroupBy,
func: Callable[[Tuple[str, pd.DataFrame]], Union[pd.DataFrame, pd.Series]],
num_cpus: int = multiprocessing.cpu_count() - 1,
@juzten
juzten / multiplecheckbox.py
Created April 11, 2015 07:48 — forked from doobeh/example.html
custom multiple checkbox field for wtforms and flask
from flask import Flask, render_template
from flask.ext.wtf import Form, widgets, SelectMultipleField
SECRET_KEY = 'development'
app = Flask(__name__)
app.config.from_object(__name__)
class MultiCheckboxField(SelectMultipleField):
widget = widgets.ListWidget(prefix_label=False)
@salcode
salcode / .gitignore
Last active July 10, 2024 14:28
Please see https://salferrarello.com/wordpress-gitignore/ for the canonical version of this WordPress .gitignore file. Note: I do not receive notifications for comments here (because GitHub does not send notifications on Gists)
# -----------------------------------------------------------------
# .gitignore for WordPress @salcode
# ver 20180808
#
# From the root of your project run
# curl -O https://gist.githubusercontent.com/salcode/b515f520d3f8207ecd04/raw/.gitignore
# to download this file
#
# By default all files are ignored. You'll need to whitelist
# any mu-plugins, plugins, or themes you want to include in the repo.
@pawl
pawl / example.html
Created December 30, 2014 10:59
Flask Inline Editing Example Using WTForms + X-Editable
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>title</title>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet">
<link href="//cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/bootstrap3-editable/css/bootstrap-editable.css" rel="stylesheet"/>
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
@fiveisprime
fiveisprime / transform.js
Last active November 29, 2017 10:40
Replace `_id` with string `id` and remove `__v` when calling `toObject()` in Mongoose.
if (!MySchema.options.toObject) {
PlanSchema.options.toObject = {};
}
MySchema.options.toObject.transform = function(doc, ret) {
// Set the id from the retrun object value which will be a string.
ret.id = ret._id;
delete ret._id;
delete ret.__v;
@hofmannsven
hofmannsven / README.md
Last active August 27, 2024 09:08
Raspberry Pi Cheatsheet