Skip to content

Instantly share code, notes, and snippets.

@hasibomi
hasibomi / changeurl.js
Last active July 20, 2023 22:47
Change URL in Browser Address Bar without reloading using JavaScript and jQuery
/* The solution found here: http://www.aspsnippets.com/Articles/Change-URL-in-Browser-Address-Bar-without-reloading-using-JavaScript-and-jQuery.aspx */
/** HTML5 History pushState method
* The pushState method works similar to window.location but it does not refresh or reload the page and it will modify the URL even if the page does not exists. The pushState method actually inserts an entry into the history of the browsers which allows us to go back and forth using the browser’s forward and back buttons.
* The pushState method accepts the following three parameters.
* 1. State object: - The state object is a JavaScript object which can contain any details about the page and must be serializable.
* 2. Title: - The title of the page.
* 3. URL – The URL of the page.
*/
@talos
talos / grid.sql
Created September 27, 2016 15:31
Create a grid in PostGIS for CARTO based off of arbitrary envelope and Projection
INSERT INTO <my_table_name> (cartodb_id, the_geom, the_geom_webmercator)
WITH inputs AS (SELECT
ST_Transform(ST_SetSRID(ST_MakeEnvelope(
-126.21093749999999, 23.241346102386135,
-63.28125, 50.064191736659104
), 4326), 5070) geom,
500000 width,
500000 height
), rast AS (SELECT
(st_pixelaspolygons(
@DakuTree
DakuTree / decryptchromecookies.py
Last active April 3, 2024 19:22
Decrypt Chrome Cookies File (Python 3) - Windows
#Based off https://gist.github.com/DakuTree/98c8362fb424351b803e & pieces of https://gist.github.com/jordan-wright/5770442
from os import getenv
from shutil import copyfile
import sqlite3
import win32crypt #https://sourceforge.net/projects/pywin32/
# Copy Cookies to current folder
copyfile(getenv("APPDATA") + "/../Local/Google/Chrome/User Data/Default/Cookies", './Cookies')
# Connect to the Database
@ka7eh
ka7eh / leaflet_to_pdf.html
Created April 12, 2016 16:55
An example for converting Leaflet maps to PDF using leaflet-image and jsPDF
<html>
<head>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css"/>
<style>
#mapid{
height: 480px;
}
#download {
position:absolute;
@bdw
bdw / geojson-to-postgis.py
Created April 12, 2016 10:03
geojson to postgis
#!/usr/bin/env python
from __future__ import print_function, unicode_literals
import operator
import psycopg2
import psycopg2.extras
import io
import json
import sys
import logging
@mesgarpour
mesgarpour / appsScript_ListFilesFolders_ver.2.js
Last active April 22, 2024 01:35
[Google Apps Script] List all files & folders in a Google Drive folder, & write into a speadsheet
/*
* Copyright 2017 Mohsen Mesgarpour
*
* 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
@karlkranich
karlkranich / apitest.php
Last active July 17, 2018 14:49
Updated PHP code to use the Google Sheets API. See usage instructions at http://karl.kranich.org/2015/04/16/google-sheets-api-php/ More examples at https://gist.github.com/karlkranich/afa39e3d778455b38c38
<?php
// apitest.php
// by Karl Kranich - karl.kranich.org
// version 3.1 - edited query section
require_once realpath(dirname(__FILE__) . '/vendor/autoload.php');
include_once "google-api-php-client/examples/templates/base.php";
$client = new Google_Client();
@brock
brock / psql-with-gzip-cheatsheet.sh
Last active April 10, 2024 10:53
Exporting and Importing Postgres Databases using gzip
# This is just a cheat sheet:
# On production
sudo -u postgres pg_dump database | gzip -9 > database.sql.gz
# On local
scp -C production:~/database.sql.gz
dropdb database && createdb database
gunzip < database.sql.gz | psql database
@akaleeroy
akaleeroy / Connect-to-Android-WebDAV-Server.md
Last active October 14, 2021 16:31
Access phone storage over WiFi with WebDAV Server for Android

Access phone storage over WiFi

Batch file to map your Android phone as network drive in Windows.

Preview of Phone.cmd usage

Requirements

@carlbergman
carlbergman / Code.gs
Created July 16, 2015 09:38
Get filtered/non-filtered values from Google Sheet with Google Apps Script
/**
* Get values in range
*
* @param {String} rangeA1 The range in A1 notation
*
* @return {Array} array with non-filtered values
*/
function getValues (rangeA1) {
// Get range