Skip to content

Instantly share code, notes, and snippets.

View ethagnawl's full-sized avatar
🐢

Pete Doherty ethagnawl

🐢
View GitHub Profile

Crippling Facebook

Facebook works with advertisers to target you. These instructions are one of the many ways to begin crippling that relationship. When AI targeting is crippled, your psychosecurity improves :)

  1. On your desktop machine, goto https://accountscenter.facebook.com/ads/audience_based_advertising
  2. Maximize the browser window
  3. Press F12 and click on the Console tab
  4. Select the code below, copy it, paste it upon the Console line (The area next to the > character in the Console window), and press enter:
@nat-418
nat-418 / why-tcl.md
Last active April 1, 2024 03:23
Why Tcl?

Why Tcl?

Introduction

I use [Tcl] as my scripting language of choice, and recently someone asked me why. This article is an attempt to answer that question.

Ousterhout's dichotomy claims that there are two general categories of programming languages:

@odigity
odigity / gist:53bf47cca9a238a905c276760153838d
Created September 3, 2022 23:44
anyk and anyq queryset methods for Django
class FooQS(models.QuerySet):
# expects zero or more filter-style kwargs
def anyk(self, **kwargs):
if len(kwargs) == 0:
return self
if len(kwargs) == 1:
return self.filter(**kwargs)
q = Q(kwargs.popitem())
for k, v in kwargs.items():
@the-toster
the-toster / docker-compose.yml
Created December 29, 2021 16:36
docker-compose replicas minimum example
version: '3'
services:
publisher_app:
image: nginx
ports:
- "8080-8081:80"
environment:
server.port: 8080
deploy:
mode: replicated
@yermulnik
yermulnik / tf_vars_sort.awk
Last active July 19, 2024 10:16
Sort Terraform (HCL) file by Resource Block Names using GNU `awk`
#!/usr/bin/env -S awk -f
# https://gist.github.com/yermulnik/7e0cf991962680d406692e1db1b551e6
# Tested with GNU Awk 5.1.0, API: 3.0 (GNU MPFR 4.1.0, GNU MP 6.2.1)
# Usage: /path/to/tf_vars_sort.awk < variables.tf | tee sorted_variables.tf
# Note: "chmod +x /path/to/tf_vars_sort.awk" before use
# No licensing; yermulnik@gmail.com, 2021-2024
{
# skip blank lines at the beginning of file
if (!resource_type && length($0) == 0) next
@ab623
ab623 / is_owner_permission.py
Last active May 13, 2023 01:36
A view decorator to be used to check the model is owned by the logged in user
from django.core.exceptions import PermissionDenied
from django.apps import apps
def is_owner_permission(model=None, url_field='pk', model_field="owner"):
"""
A decorator to be used on a function based view that will check if
a model instance belongs to the logged in user
Keyword arguments:
model=None - Name of the model to check. Can be a model
@scimad
scimad / age_not_okay.html
Last active June 24, 2024 14:59
Basic python HTTP server and manipulation of POST data
<!DOCTYPE html>
<html>
<head>
<title>Not eligible</title>
</head>
<body>
<h1>Oops, you are too young to have your own conscience. Try again next year.</h1>
</body>
</html>
@mhitza
mhitza / vim-guile.md
Last active July 15, 2024 01:26
vim + GNU Guile development environment

This document was based on my local [GNU Guile][1]-3.0.5 setup. I'm not sure if it works as is with an older version of GNU Guile.

Because of a [dependency in Fedora][2] I had to compile GNU Guile from source release. As such, in your local setup the paths will differ. This is only relevant when defining the GUILE shell variable, and referencing the tags file in the vimrc.

Note that when building GNU Guile from source be sure that you have the readline-devel (or distro equivalent package) installed. That way the ./configure step will pick that up, and the ice-9 readline module will be usable.

@arvidma
arvidma / sequence_binder.py
Last active March 2, 2023 20:10
Bind tuples to parameterized queries with SQLite on Python
"""
Cross-database compatbile SQLite work-arounds for binding sequences to parameterized queries.
Usage:
bind_pattern, bind_dict = sequence_for_binding( {1, 2, 3} )
query = f"SELECT * FROM mytable WHERE id IN {bind_pattern}"
execute(query, bind_dict)
or, for nested sequences:
@HidemotoKisuwa
HidemotoKisuwa / DataImporter.py
Created November 6, 2020 11:55
Insert Data Through API
import httplib2
import os
from apiclient import discovery
from google.oauth2 import service_account
try:
scopes = ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/spreadsheets"]
secret_file = os.path.join(os.getcwd(), 'client_secret.json')