Skip to content

Instantly share code, notes, and snippets.

@rszeto
rszeto / *pycharm-setup-2020.3.2.md
Last active Aug 12, 2021
Setting up PyCharm project with remote interpreter
View *pycharm-setup-2020.3.2.md

Setting up PyCharm project with remote interpreter

Setting up a remote interpreter on PyCharm is awfully unintuitive. I've pared it down to what I think is the minimal number of steps, and leaves the fewest number of deployment configurations and Python interpreters lying around. This is designed for my specific configuration (specifically PyTorch); adapt as needed.

Configuring default project (only do after installing PyCharm for the first time):

  1. (Optional) Add virtual environment path to excluded files
    1. From Welcome Page, go to Configure > Settings > Build, Execution, Deployment > Deployment > Options
    2. Add virtualenv path. For example, if you always have the project's virtualenv in .env, add ";.env" to the "Exclude items by name" field
@rivo
rivo / postgres.go
Last active Aug 12, 2021
A demo Go application (a PostgreSQL database browser) highlighting the use of the rivo/tview package. See https://github.com/rivo/tview/wiki/Postgres
View postgres.go
package main
import (
"database/sql"
"fmt"
"net/url"
"os"
"reflect"
"regexp"
"strconv"
@ajdruff
ajdruff / fix-git-line-endings
Last active Jan 20, 2022
Forces all line endings to LF in your git repo.
View fix-git-line-endings
#####################
#
# Use this with or without the .gitattributes snippet with this Gist
# create a fixle.sh file, paste this in and run it.
# Why do you want this ? Because Git will see diffs between files shared between Linux and Windows due to differences in line ending handling ( Windows uses CRLF and Unix LF)
# This Gist normalizes handling by forcing everything to use Unix style.
#####################
# Fix Line Endings - Force All Line Endings to LF and Not Windows Default CR or CRLF
@Blake-
Blake- / gist:fc00725d519a25a55b3c2368d1ee238d
Created Oct 21, 2017
Mounting a s3ql file system to the S3 compatible file system at Softlayer on an Ubuntu 16 Xenial VSI
View gist:fc00725d519a25a55b3c2368d1ee238d
Mounting a s3ql file system to the S3 compatible file system at Softlayer on an Ubuntu 16 Xenial VSI
apt install s3ql
nano /etc/s3ql.authinfo
[softlayer-s3]
backend-login: somelogin
@rodricels
rodricels / .tmux.conf
Last active Aug 25, 2021
tmux configuration, mouse copy & paste added
View .tmux.conf
# My tmux configuration, partly based on https://github.com/wbkang/wbk-stow/blob/master/tmux-config/.tmux.conf
# Scroll History
set -g history-limit 50000
# show messages for 4 seconds instead
set -g display-time 4000
# set first window to index 1 (not 0) to map more to the keyboard layout
set-option -g renumber-windows on
@asukakenji
asukakenji / 0-go-os-arch.md
Last active Jan 18, 2022
Go (Golang) GOOS and GOARCH
View 0-go-os-arch.md

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.17.1 darwin/amd64.

GOOS Values

GOOS Out of the Box
aix
android
@jonlabelle
jonlabelle / crlf.py
Last active Oct 11, 2021
Replace CRLF (windows) line endings with LF (unix) line endings in files.
View crlf.py
#!/usr/bin/env python
"""Replace line breaks, from one format to another."""
from __future__ import print_function
import argparse
import glob
import os
import sys
@DmitryBe
DmitryBe / app.py
Created Mar 3, 2017
SQLAlchemy quick start
View app.py
# http://bytefish.de/blog/first_steps_with_sqlalchemy/
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import create_engine
from datetime import datetime, timedelta
from sqlalchemy import Table, Column, Integer, String, DateTime, ForeignKey
from sqlalchemy.orm import relationship, backref
from sqlalchemy.orm import sessionmaker
Base = declarative_base()
@barbietunnie
barbietunnie / udemy-courses-download-using-cookies.md
Last active Jan 7, 2022
Downloading Udemy videos with youtube-dl
View udemy-courses-download-using-cookies.md

How to download your Udemy course videos using youtube-dl

$ youtube-dl --list-extractors | grep udemy

Steps

  1. Get link to the course to download. e.g. https://www.udemy.com/course-name/
  2. Login into udemy website, save the cookie from chrome using Chrome (Cookie.txt)[1] export extension. Save it to file udemy-cookies.txt
  3. Get the link of the video that you want to download. usually in format. Use the command provided below where you have to replace the {course_link} and {path_to_cookies_file} with respective paths.
$ youtube-dl {course_link} --cookies {path_to_cookies_file}
@brianmfear
brianmfear / AWS.apxc
Last active Jan 5, 2021
AWS SQS Methods, in Apex Code.
View AWS.apxc
public abstract class AWS {
// Post initialization logic (after constructor, before call)
protected abstract void init();
// XML Node utility methods that will help read elements
public static Boolean getChildNodeBoolean(Dom.XmlNode node, String ns, String name) {
try {
return Boolean.valueOf(node.getChildElement(name, ns).getText());
} catch(Exception e) {
return null;