This is a collection of information on PostgreSQL and PostGIS for what I tend to use most often.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import configparser | |
from dataclasses import dataclass | |
@dataclass | |
class Sections: | |
raw_sections: dict | |
def __post_init__(self): | |
for section_key, section_value in self.raw_sections.items(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Found in this issue thread https://github.com/jinzhu/gorm/issues/516#issuecomment-109055198 | |
// License unknown | |
// | |
// | |
// Postgres' JSONB type. It's a byte array of already encoded JSON (like json.RawMessage) | |
// which also saves itself correctly to PG's jsonb type. It would probably also work on | |
// PG json types. | |
type JSONB []byte | |
func (j JSONB) Value() (driver.Value, error) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule MasterProxy.Application do | |
alias MyApp.Endpoint, as: MyAppEndpoint | |
alias MyApp.UserSocket, as: MyAppUserSocket | |
alias MyOtherApp.Endpoint, as: MyOtherAppEndpoint | |
alias MyOtherApp.UserSocket, as: MyOtherAppUserSocket | |
alias Phoenix.LiveReloader.Socket, as: LiveReloadSocket | |
alias Plug.Cowboy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ScrollViewWithHeight extends StatelessWidget { | |
final Widget child; | |
const ScrollViewWithHeight({Key key, this.child}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return new LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints) { | |
return new SingleChildScrollView( | |
child: new ConstrainedBox( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -x | |
# This script will convert all your git submodules into git subtrees. | |
# This script ensures that your new subtrees point to the same commits as the | |
# old submodules did, unlike most other scripts that do this. | |
# THIS SCRIPT MUST BE PLACED OUTSIDE OF YOUR REPOSITORY!!!!!!!!!! | |
# Otherwise, the script will interfere with the git commits (unless you add it to .gitignore). | |
# Save the script in your home directory as `~/subtrees.sh` | |
# `cd` into your repository | |
# Run `~/subtrees.sh` | |
# Enjoy! |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
CMDNAME=`basename $0` | |
while getopts n OPT | |
do | |
case $OPT in | |
"n" ) DRY_RUN="--dry-run" ;; | |
* ) echo "Usage: $CMDNAME [-n]" 1>&2 | |
exit 1 ;; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Renames subtitles files according to tv shows names found in a directory | |
# Acceped syntaxes for season/episode are: 304, s3e04, s03e04, 3x04 (case insensitive) | |
# | |
# Usage: | |
# Put this gist somewhere in your $PATH, like /usr/local/bin/subtitles-renamer | |
# Chmod +x it | |
# cd ~/YourHolidaysTvShowsWithSubtitles | |
# subtitles-renamer |
$ brew install dnsmasq
$ vim /usr/local/etc/dnsmasq.conf
# Copy the daemon configuration file into place.
$ sudo cp $(brew list dnsmasq | grep /homebrew.mxcl.dnsmasq.plist$) /Library/LaunchDaemons/
$ sudo launchctl unload /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
NewerOlder