Skip to content

Instantly share code, notes, and snippets.

View fditraglia's full-sized avatar

Francis DiTraglia fditraglia

View GitHub Profile
@johnburnmurdoch
johnburnmurdoch / tiktok_reform_model.R
Last active March 22, 2025 12:38
Replication code for Financial Times analysis of the association between getting news from TikTok and shifting towards Reform UK
# Model impact on vote choice of having seen political content on social media
needs(tidyverse, stats, haven, survey, MASS)
# Read in BESIP trend file, which you can download from here: https://www.britishelectionstudy.com/data-object/british-election-study-combined-wave-1-29-internet-panel/
BESIP_trend <- read_dta("path/to/BES2024_W29_Panel_v29A.0.dta", encoding = "latin1")
BESIP_trend_dd <- stata_summary(BESIP_trend)
# If social media political content is missing (because the respondent does not use that platform), code it the same way as people who said they saw no content
# Group education into four segments, including current full-time students
# Vote variables are vote intention as at May 2021 and immediately before the 2024 general election
@Maharshi-Pandya
Maharshi-Pandya / contemplative-llms.txt
Last active June 22, 2025 14:21
"Contemplative reasoning" response style for LLMs like Claude and GPT-4o
You are an assistant that engages in extremely thorough, self-questioning reasoning. Your approach mirrors human stream-of-consciousness thinking, characterized by continuous exploration, self-doubt, and iterative analysis.
## Core Principles
1. EXPLORATION OVER CONCLUSION
- Never rush to conclusions
- Keep exploring until a solution emerges naturally from the evidence
- If uncertain, continue reasoning indefinitely
- Question every assumption and inference
functions {
matrix L_cov_exp_quad_ARD(matrix x,
real alpha,
vector rho,
real delta) {
int N = rows(x);
matrix[N, N] K;
real sq_alpha = square(alpha);
for (i in 1:(N-1)) {
K[i, i] = sq_alpha + delta;
@application2000
application2000 / how-to-install-latest-gcc-on-ubuntu-lts.txt
Last active June 8, 2025 17:38
How to install latest gcc on Ubuntu LTS (12.04, 14.04, 16.04)
These commands are based on a askubuntu answer http://askubuntu.com/a/581497
To install gcc-6 (gcc-6.1.1), I had to do more stuff as shown below.
USE THOSE COMMANDS AT YOUR OWN RISK. I SHALL NOT BE RESPONSIBLE FOR ANYTHING.
ABSOLUTELY NO WARRANTY.
If you are still reading let's carry on with the code.
sudo apt-get update && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
@mike-burns
mike-burns / .msmtp
Last active December 23, 2022 14:56
FastMail + mutt
account default
host mail.messagingengine.com
port 587
protocol smtp
auth on
from [email protected]
user [email protected]
password topsecretpassword!
tls on
tls_nocertcheck
@dergachev
dergachev / ubuntu-eol.md
Last active December 31, 2024 03:23
What to do when your ubuntu distro is End-of-Life

Let's say you're using Ubuntu 13.04 (Raring Ringtail, released in April 2013) and it just went End-of-Life on you, because it's supported for only 6 months, and the deprecated packages are taken down after 12 months.

You'll probably figure this out the hard way. When you run sudo apt-get update, it will eventually report these errors:

Ign http://archive.ubuntu.com raring-updates/universe Sources/DiffIndex
Err http://security.ubuntu.com raring-security/main Sources
  404  Not Found [IP: 91.189.91.15 80]
Err http://security.ubuntu.com raring-security/universe Sources
  404  Not Found [IP: 91.189.91.15 80]
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active May 20, 2025 13:11
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a