Skip to content

Instantly share code, notes, and snippets.

@willurd
willurd / web-servers.md
Last active April 25, 2024 09:21
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@ziadoz
ziadoz / install.sh
Last active April 20, 2024 10:18
Install Chrome, ChromeDriver and Selenium on Ubuntu 16.04
#!/usr/bin/env bash
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
# https://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver
# https://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception
# https://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal
# https://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04
# Versions
CHROME_DRIVER_VERSION=`curl -sS https://chromedriver.storage.googleapis.com/LATEST_RELEASE`
@christippett
christippett / rclone-cron.sh
Last active April 13, 2024 20:20 — forked from jaredmales/rclone-cron.sh
An rclone backup script for cron
#!/bin/bash
##############################################################################
# An rclone backup script by Chris Tippett (c.tippett@gmail.com)
#
# Originally adapted from the great work by Jared Males (jaredmales@gmail.com)
# https://gist.github.com/jaredmales/2f732254bb10002fc0549fa9aa0abdd7
#
# Copyright (C) 2020 Chris Tippett (c.tippett@gmail.com)
#
@kekru
kekru / 01nginx-tls-sni.md
Last active April 1, 2024 02:29
nginx TLS SNI routing, based on subdomain pattern

Nginx TLS SNI routing, based on subdomain pattern

Nginx can be configured to route to a backend, based on the server's domain name, which is included in the SSL/TLS handshake (Server Name Indication, SNI).
This works for http upstream servers, but also for other protocols, that can be secured with TLS.

prerequisites

  • at least nginx 1.15.9 to use variables in ssl_certificate and ssl_certificate_key.
  • check nginx -V for the following:
    ...
    TLS SNI support enabled
@flcong
flcong / fast_split_apply_combine.ipynb
Last active March 26, 2024 02:24
Fast Split-Apply-Combine using Numba
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@marioBonales
marioBonales / .bashrc
Created January 19, 2012 03:56
Default .bashrc for ubuntu
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
@Bahus
Bahus / json_schemed_field.py
Last active November 15, 2023 10:12
Django JSONField with Pydantic schema support
from functools import partial
import pydantic
import logging
from django.contrib.postgres.fields import JSONField
from typing import Type, Union, Tuple
from django.core.serializers.json import DjangoJSONEncoder
@kfigiela
kfigiela / _README.md
Last active July 13, 2023 10:14
Traktor Kontrol S5 S8 hacks

Warnings and instructions

  • You need to modify some Traktor files – do backup before you try – if files are incorrects screens become black.
  • You're doing that at your own risk!
  • If sth goes really bad – reinstall Traktor :-)
  • Traktor QML files are located by default in /Applications/Native Instruments/Traktor 2/Traktor.app/Contents/Resources/qml on Mac, on Windows look for qml in directory where Traktor is installed (I don't have windows machine around)…
  • You need real text-editor to modify files, you should try with Atom or Notepad++ to apply modifications
  • Files here are so called diff files, here is how to read them: http://stackoverflow.com/questions/2529441/how-to-read-the-output-from-git-diff

Hacks

@codingforentrepreneurs
codingforentrepreneurs / Django for Jupyter.md
Last active June 16, 2023 19:38
Django Setup for use in Jupyter Notebooks

Django for Jupyter

It's true packages exist to make it "easy" to use Django inside of a jupyter notebook. I seem to always run into issues successfully running these packages. I've found the below method useful although I cannot recall how I discovered how this works (aka attribution needed).

Requirements

  • Virtual Environment (virtualenv, venv, pipenv, etc)
  • Django installed & project created (we'll use the project name cfehome)
  • Jupyter installed at least in the virtual environment
@atruskie
atruskie / terminal-keybind.ahk
Last active December 30, 2022 15:44
AutoHotkey script to bind Win+~ keyboard shortcut to Windows Terminal
#NoEnv
#SingleInstance force
SendMode Input
DetectHiddenWindows, on
SetWinDelay, 0
#`::
terminal := WinExist("ahk_exe WindowsTerminal.exe")
if (terminal)
{