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 June 24, 2024 22:26
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>
@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')
@brecert
brecert / flems.io
Last active October 4, 2022 17:32
yaml to s-expressions
https://flems.io/#0=N4IgtglgJlA2CmIBcA2ArAOgJwA4A0IAzgMYBOA9rLMgNoCMdaATBgOxp4AMAugQGYQEhWqAB2AQzCIkIDAAsALmGoFi5UQvgbkIEAF88YydNkArYavWbtMiGAAO5UgoAEATQCCAWQAyLvhRgLgDkigr2hEgA9FHm9mAYUPAAblEAnpKwwQDcADqi+WqihK4Zyi4AvO7ePhj24qSE8AAUAAb5YORQAK4ISPkuLgC0LlKdpGlILvAAHo7OLrng8ONpS3gudAPDLlDiCuJTEADMLEUlLpwbS3LwVOQuCrek8ACES9sjfN2ixFMAPttBoNZvNXEsAOYveAKCCiCHrFwvQi9VwnJgudFA4HZbIuch8PhNVwElwlUhwiGY0SjFZONY04GDdEYc6uTjYwa4lwIeFPTmY06s9QXOhMfKtACUeQKvxFrlB8GImigAHluvZuq4qu1RM1Oj0ENt9XSJi5mqCnODlmAlpLNpLjXsDuaWWzLvabndYA8nvAXu8QI7Gc1vr9zZaFpDobD4QB9O3m5GowUY9HBpnNN3yj1M7kEokw-F8MkKCnw6m01bYrNC91i+1cvG8iH8xnByWtGX5MPKiDqFz1RrwHxw+AAUTmpGasDHGwEElg9uA23doMalR5Y4whHss4UzWCeGCkowYHE9gtlQAfNMMGW7M1JRmkTDuqQaevCGeL80LVONgge0KlvFdGWZPg-wXcRYBcAAyODMUqCoqi-DAWyeIY6Htf5-mmKcdwOZxCAAdQgJ5D1xE9lwFF4FHfT8p2xPRplgJoXDAplBjohiXFaZoABJgHXPRO2Y7ZRIwUxyDhQ8QmDPR8h7H4+wHIcmi8VFBDHSd7GnWdRHgQhAJoxl3XILVNxobhVxzBpSHENJCE3AyjJ3PdyMPXJ8hPbY+CcGciwgTdODxYKAB4XHsxzvwwuQwoAagS0ymQQVxXM3aKnJoCBuBlJkIEgjKUKqYITxcIpY26eBsTSwcGiaKBN3UkcdKnGc5yQ