Skip to content

Instantly share code, notes, and snippets.

@UniIsland
UniIsland / SimpleHTTPServerWithUpload.py
Created August 14, 2012 04:01
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
@techniq
techniq / audit_mixin.py
Created March 16, 2013 01:05
Useful SQLAlchemy Mixins
from datetime import datetime
from sqlalchemy import Column, Integer, DateTime, ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declared_attr
from flask_security import current_user
class AuditMixin(object):
created_at = Column(DateTime, default=datetime.now)
updated_at = Column(DateTime, default=datetime.now, onupdate=datetime.now)
@ericandrewlewis
ericandrewlewis / index.md
Last active June 6, 2024 01:43
C++ Pointer Tutorial

C++ Pointer Tutorial

Because pointers can be ugh

"Regular" variables (not pointers)

To understand a pointer, let's review "regular" variables first. If you're familiar with a programming language without pointers like JavaScript, this is what you think when you hear "variable".

When declaring a variable by identifier (or name), the variable is synonymous with its value.

@disconnect3d
disconnect3d / template_use_loop_counter_as_tpl_arg.cpp
Last active December 12, 2019 13:54
C++ template for loop which use loop counter as template argument
#include <iostream>
#include <array>
template<size_t c>
struct ForLoop {
template<template <size_t> class Func>
static void iterate() {
Func<c>()();
ForLoop<c-1>::template iterate<Func>();
}
@kototama
kototama / nethack_change_direction_keys.patch
Created July 17, 2018 15:53
How to change direction keys in NetHack
diff --git a/src/cmd.c b/src/cmd.c
index d7303ec..44bc0b5 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -3927,7 +3927,8 @@ void
reset_commands(initial)
boolean initial;
{
- static const char sdir[] = "hykulnjb><",
+ static const char sdir [] = "nluyi.eh><",
@sammdu
sammdu / ytdl.py
Last active September 10, 2020 00:16
[ytdl.py] Download a list of songs from YouTube, at the best audio quality. Can optionally download videos as well.
#!/usr/bin/env python3
import subprocess
from argparse import ArgumentParser
from pathlib import Path
from sys import exit, stderr
# [1/3] COMMAND LINE ARGUMENTS
@logical-and
logical-and / README.md
Last active October 22, 2023 13:02 — forked from pcworld/_README.md
Linux Spotify Ad Mute

We all love Spotify, but sometimes people (like us) want to throw a party without having to listen to interrupting ads before having bought Spotify Premium. Well, with this killer project, now you can!

This is for testing purposes ONLY! Spotify is a fantastic service and worth every penny. This script is NOT meant to circumvent buying premium! Please do consider switching to premium to support Spotify - especially if you're going to use it on mobile. If the script does not work for you, help us improve it!

Usage

wget -O spotify-mute-ads.sh https://gist.githubusercontent.com/logical-and/825bab160d604d82bf6ad9ebd3a6410d/raw/84f77518f6fa8980e73fcf1fadd30d223f2100a1/spotify-mute-ads.sh
chmod ug+x spotify-mute-ads.sh
./spotify-mute-ads.sh