Skip to content

Instantly share code, notes, and snippets.

@sourcec0de
sourcec0de / PrivateTorrent.md
Last active September 1, 2022 09:04
Host a private torrent tracker, and seed a torrent on ubuntu 12.10

Install dep, and start tracker

sudo apt-get install bittornado ctorrent
bttrack --port 6969 --dfile ~/.bttrack/dstate --logfile ~/.bttrack/tracker.log --nat_check 0 --scrape_allowed full

Now, create a torrent file

ctorrent -t -u "YOUR_SERVER_IP:6969/announce" -s new_file_name.torrent file_or_folder_for_torrent
@audreyfeldroy
audreyfeldroy / pypi-release-checklist.md
Last active February 23, 2023 15:03
My PyPI Release Checklist
  • Update HISTORY.md
  • Commit the changes:
git add HISTORY.md
git commit -m "Changelog for upcoming release 0.1.1."
  • Update version number (can also be minor or major)
bumpversion patch
@nickjacob
nickjacob / systemd-prblm.service
Last active March 17, 2023 16:11
execute arbitrary bash code/variable substitution in systemd units
[Unit]
Description=Demonstrate Bash
[Service]
ExecStartPre=/usr/bin/bash -c "/usr/bin/systemctl set-environment MYVAR=$(( 2 + 2 ))"
ExecStart=/usr/bin/echo "2 + 2 = ${MYVAR}"
@guycalledseven
guycalledseven / osx_yosemite_disable_features.sh
Last active August 16, 2021 01:57
Disabling OSX Yosemite annoyances / features I have no use of
# Tested on OSX Yosemite 10.10.4
# there is also an updated version (work in progress) for El Capitan here https://gist.github.com/guycalledseven/31ffe35eca056838b06b
# XXX TODO
# should I disable com.google.Keystone.Agent ??
# http://applehelpwriter.com/2014/07/13/how-to-remove-googles-secret-update-software-from-your-mac/
# Stop DS_Store file creation on network connections
# restart Finder afterwards
@samkeen
samkeen / ec2-instance-subnet-id.md
Last active January 23, 2024 17:07
Get the subnet and VPC id of a running EC2 instance

First get the Interface mac address, then use that to run the full command

INTERFACE=$(curl --silent http://169.254.169.254/latest/meta-data/network/interfaces/macs/)
SUBNET_ID=$(curl --silent http://169.254.169.254/latest/meta-data/network/interfaces/macs/${INTERFACE}/subnet-id)
VPC_ID=$(curl --silent http://169.254.169.254/latest/meta-data/network/interfaces/macs/${INTERFACE}/vpc-id)

echo SUBNET_ID
@alanwill
alanwill / s3-bucket-move
Created December 5, 2015 20:27
Move an S3 bucket to a different region
aws s3 sync s3://oldbucket s3://newbucket --source-region us-west-1 --region us-west-2
@17twenty
17twenty / gist:2fb30a22141d84e52446
Created February 22, 2016 01:04
POST with NewRequest using Golang
package main
import (
"bytes"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
)
@danijar
danijar / blog_tensorflow_sequence_classification.py
Last active December 24, 2021 03:53
TensorFlow Sequence Classification
# Example for my blog post at:
# https://danijar.com/introduction-to-recurrent-networks-in-tensorflow/
import functools
import sets
import tensorflow as tf
def lazy_property(function):
attribute = '_' + function.__name__
@jatcwang
jatcwang / gist:ae3b7019f219b8cdc6798329108c9aee
Created February 2, 2017 23:44
List of all setxkbmap configuration options (including models/layout/etc)
! model
pc101 Generic 101-key PC
pc102 Generic 102-key (Intl) PC
pc104 Generic 104-key PC
pc105 Generic 105-key (Intl) PC
dell101 Dell 101-key PC
latitude Dell Latitude series laptop
dellm65 Dell Precision M65
everex Everex STEPnote
flexpro Keytronic FlexPro
@ageis
ageis / certbot_exporter.md
Last active November 15, 2023 23:22
certbot Prometheus exporter (Let's Encrypt metrics)

This is a script written in Python intended to run alongside a certbot instance and export statistics for monitoring purposes. It assumes the existence of certbot in the PATH plus read access to /etc/letsencrypt.

It tracks stuff like: number of certs, number of SANs, expiry time, seconds until expiry, and the status of the certificate per ACME.

How it works

Prometheus is a monitoring system and time-series database.