Skip to content

Instantly share code, notes, and snippets.

@noelbundick
noelbundick / Dockerfile
Last active March 28, 2024 12:26
Consuming packages from a private Azure Pipelines Python artifact feed
# We set an environment variable in this phase so it gets picked up by pip, but we don't want to bake secrets into our container image
FROM python:3.6-alpine AS builder
ARG INDEX_URL
ENV PIP_EXTRA_INDEX_URL=$INDEX_URL
COPY requirements.txt .
RUN pip install -U pip \
&& pip install --user -r requirements.txt
@7468696e6b
7468696e6b / okular-appleSilicon.md
Last active March 28, 2024 12:26
how to install Okular viewer on macOS Big Sur, using M1/Apple Silicon/arm64
  1. Install homebrew from https://brew.sh/ (follow the instructions there)
  2. tap the https://invent.kde.org/packaging/homebrew-kde/ repo, brew tap kde-mac/kde https://invent.kde.org/packaging/homebrew-kde.git
  3. brew edit okular, workaround now is to comment out or delete the line depends_on "chmlib" (won't compile on macos arm64 for now as of 2021-08-18), then save (if using vim you need to first press i to insert/type, when saving then <esc> then :wq then <enter>.
  4. brew install okular, wait for stuff to compile and/or install
  5. It may ask for keychain credentials (to sign the binaries? because of mac arm64 security policy https://eclecticlight.co/2021/01/26/when-you-dont-have-permission-to-run-an-app-on-an-m1-mac/)
  6. $(brew --repo kde-mac/kde)/tools/do-caveats.sh
  7. Now okular is in your $HOME/Applications/KDE folder, and will show up in Launchpad! You can view pdf, djvu, etc documents.
@jakebrinkmann
jakebrinkmann / connect_psycopg2_to_pandas.py
Created July 3, 2017 14:19
Read SQL query from psycopg2 into pandas dataframe
import pandas as pd
import pandas.io.sql as sqlio
import psycopg2
conn = psycopg2.connect("host='{}' port={} dbname='{}' user={} password={}".format(host, port, dbname, username, pwd))
sql = "select count(*) from table;"
dat = sqlio.read_sql_query(sql, conn)
conn = None
@mahemoff
mahemoff / README.md
Last active March 28, 2024 12:23
Vim Terminal Mode - A short introduction

Vim has a Terminal Mode!

Since v8.1 (May 2018), Vim has shipped with a built-in terminal. See https://vimhelp.org/terminal.txt.html or type :help terminal for more info.

Why use this? Mainly because it saves you jumping to a separate terminal window. You can also use Vim commands to manipulate a shell session and easily transfer clipboard content between the terminal and files you're working on.

Key Bindings

@OrionReed
OrionReed / DOM3D.js
Last active March 28, 2024 12:22
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@mateuszkwiatkowski
mateuszkwiatkowski / vscode-remote-ssh-freebsd.md
Last active March 28, 2024 12:22
Configure FreeBSD to work with VScode's remote ssh extension

This procedure was tested on FreeBSD-CURRENT build from d8819d88af52.

  1. Enable linuxulator and install linux userland:
    # sysrc linux_enable="YES"
    # service linux start
    # pkg install linux_base-c7
    
@jonashaag
jonashaag / gist:7ca5b19abf537a447d0de1b923043f45
Last active March 28, 2024 12:20
T60/RT60, C50/C80, D in Python
import librosa
from scipy.signal import butter, lfilter
SR = 8000
NFFT = 256 # change ~proportionally to SR
def butter_bandpass(lowcut, highcut, fs, order=5):
nyq = 0.5 * fs
low = lowcut / nyq
@krishnamurthydasari
krishnamurthydasari / Git Notes
Last active March 28, 2024 12:20
Git Notes
Creating new repository:
========================
Create a new repository on GitHub by selecting initialize this repository with README.
Clone repository using below commands,
git clone https://github.com/krishnamurthydasari/TestProject.git
touch NewFile.txt
git add NewFile.txt
git status
@danidiaz
danidiaz / netrw.txt
Created October 7, 2016 20:57
Vim's netrw commands.
--- ----------------- ----
Map Quick Explanation Link
--- ----------------- ----
< <F1> Causes Netrw to issue help
<cr> Netrw will enter the directory or read the file |netrw-cr|
<del> Netrw will attempt to remove the file/directory |netrw-del|
<c-h> Edit file hiding list |netrw-ctrl-h|
<c-l> Causes Netrw to refresh the directory listing |netrw-ctrl-l|
<c-r> Browse using a gvim server |netrw-ctrl-r|
<c-tab> Shrink/expand a netrw/explore window |netrw-c-tab|
@amunchet
amunchet / noVNCCopyPasteProxmox.user.js
Last active March 28, 2024 12:17
Copy/Paste for noVNC Proxmox
// ==UserScript==
// @name noVNC Paste for Proxmox
// @namespace http://tampermonkey.net/
// @version 0.2a
// @description Pastes text into a noVNC window (for use with Proxmox specifically)
// @author Chester Enright
// @match https://*
// @include /^.*novnc.*/
// @require http://code.jquery.com/jquery-3.3.1.min.js
// @grant none