Skip to content

Instantly share code, notes, and snippets.

View himat's full-sized avatar
💭
Making

Hima himat

💭
Making
View GitHub Profile
@lpinner
lpinner / resample_raster.py
Last active November 23, 2023 21:11
rasterio resample raster
# Copyright 2019 Luke Pinner
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@tobymurray
tobymurray / sendEmail.js
Last active February 29, 2020 09:23
Send email with Gmail and NodeJS
const fs = require('fs');
const readline = require('readline');
const google = require('googleapis');
const googleAuth = require('google-auth-library');
const Base64 = require('js-base64').Base64;
const SCOPES = ['https://mail.google.com/',
'https://www.googleapis.com/auth/gmail.modify',
'https://www.googleapis.com/auth/gmail.compose',
'https://www.googleapis.com/auth/gmail.send'
@e0ipso
e0ipso / read-only-property-es6.js
Last active March 16, 2024 21:09
Read only property ES6
/**
* Class that holds a read only property.
*/
class PropertyBag {
/**
* Accessor.
*
* @return {string}
* The value. This annotation can be used for type hinting purposes.
@joshnuss
joshnuss / app.js
Last active March 4, 2024 00:01
Express.js role-based permissions middleware
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./authorization"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection
@utek
utek / Exclude_tables.md
Last active June 6, 2024 08:11
Define ignored tables in alembic.ini

Add this in your ini file:

[alembic:exclude]
tables = spatial_ref_sys

In env.py:

    import re 
    
// Listens when new request
chrome.webRequest.onHeadersReceived.addListener(function(details) {
for (i = 0; i < details.responseHeaders.length; i++) {
if (isCSPHeader(details.responseHeaders[i].name.toUpperCase())) {
var csp = details.responseHeaders[i].value;
// append "https://mysite.com" to the authorized sites
csp = csp.replace('script-src', 'script-src https://mysite.com');
csp = csp.replace('style-src', 'style-src https://mysite.com');
@mkottman
mkottman / twoline_prompt.sh
Last active July 19, 2023 06:53
A two-line colored Bash prompt (PS1) with Git branch and a line decoration which adjusts automatically to the width of the terminal. Recognizes SVN, Git and Fossil version control systems and shows the current branch/revision.
# A two-line colored Bash prompt (PS1) with Git branch and a line decoration
# which adjusts automatically to the width of the terminal.
# Recognizes and shows Git, SVN and Fossil branch/revision.
# Screenshot: http://img194.imageshack.us/img194/2154/twolineprompt.png
# Michal Kottman, 2012
RESET="\[\033[0m\]"
RED="\[\033[0;31m\]"
GREEN="\[\033[01;32m\]"
BLUE="\[\033[01;34m\]"