Skip to content

Instantly share code, notes, and snippets.

View psyguy's full-sized avatar
😌
Keeping it together.

MH Manuel Haqiqatkhah psyguy

😌
Keeping it together.
View GitHub Profile
@psyguy
psyguy / rsdb.json
Created January 22, 2026 18:17 — forked from Vizdun/rsdb.json
The Racial Slur Database
[
{
"slur": "10% Off",
"group": "Jews",
"desc": "Refers to circumcision and consumerism (never pay retail). The term is most widely used in the UK where circumcision among non-Jews or non-Muslims is more rare, but in the United States, where it is more common, it can be considered insulting to many non-Jewish males as well."
},
{
"slur": "51st Stater",
"group": "Canadians",
"desc": "Canada is so culturally similar to the U. S. that they are practically the 51st state"
@psyguy
psyguy / bibtex-cleaner.R
Created August 14, 2023 15:09
The following R script (generated using ChatGPT-4) takes a LaTeX file and a biblatex file and gives a crean list of the sources cited, as well as a .bib file containint only the cited sources. It depends on the citationkey style I use consistently (firstauthor_YEAR_ThreeWordTitle), and is handy when submitting clean files for publication.
library(stringr)
library(readr)
# Extract citation keys based on the provided pattern.
extract_citation_keys <- function(tex_file) {
# Read the content of the .tex file
tex_content <- readLines(tex_file, warn = FALSE)
# Regular expression pattern for the citation keys
pattern <- "\\b[a-z]+-?[a-z]*_\\d{4}_[a-zA-Z-]+(?:_[a-zA-Z-]+)?(?:_[a-zA-Z-]+)?\\b"
@psyguy
psyguy / mscomputer.md
Created March 24, 2023 09:09 — forked from vankesteren/mscomputer.md
Documentation for using the Methods & Statistics department compute server

Popular Iranian Names – 1383-1396

A few days back, Peyman Asadzade, a polotical scientist at Arizona State University, posted the following tweet, holding what he called “the decline in the popularity of religious names for babies” as an example for “considerable evidence of growing secularization in Iran.”

@psyguy
psyguy / 50 most popular Iranian names, 2000-2017.md
Last active May 7, 2020 09:46
بسامد 50 اسم پرتکرار نوزادان ایرانی در سال‌های 1380-1396 (2000-2017) برگرفته از سایت سازمان ثبت احوال کشور
@psyguy
psyguy / QoUL_Survey-key.csv
Created April 18, 2020 10:53
کلید پرسش‌ها و گزینه‌های پیمایش رصد کیفیت زندگی شهری در تهران، 1394
We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 35 columns, instead of 7 in line 7.
Question.Code,Description,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
Case.Number,شماره پرسشنامه,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA
District,منطقه شهرداری,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA
NeighborhoodCode2,نام محله,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA
Population,جمعیت محله در سرشماری,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA
Q1,مدت اقامت در محله,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA
Q2,قبل از سکونت در این محل کجا بودید؟,NA,NA,از زمان تولد در همین خانه بوده ام,مکان دیگر در این محله,محله دیگر در این منطقه,منطقه ای دیگردر تهران,شهر یا کشور دیگر,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA
Q3,تعداد خویشاوندان در محله,NA,NA,NA,NA,NA
@psyguy
psyguy / 2015-2016 Quality of Urban Life.md
Last active April 18, 2020 16:05
Quality of Urban Life in Tehran 2015-2016 | پیمایش رصد کیفیت زندگی شهری در تهران، 1394

To be added later, if needed.

The raw data (in .sav format) can be downloaded Tehran Municipality's website

The QoUL-cleaning.R code cleans the data and outputs the responses and key to the survey (question and option description) in .csv files. The .csv files are included in this Gist. (In case you face problems previewing key online, find it here.)

The code is commented in details. In case of further questions, contact me on Twitter @_psyguy

@psyguy
psyguy / 0-Readme.md
Last active April 18, 2020 09:59
Quality of Urban Life in Tehran 2014-2015 | پیمایش رصد کیفیت زندگی شهری در تهران، 1394

To be added later, if needed.

The raw data (in .sav format) can be downloaded Tehran Municipality's website

The QoUL-cleaning.R code cleans the data and outputs the responses and key to the survey in .csv files. The .csv files are included in this Gist.

The code is commented in details. In case of further questions, contact me on Twitter @_psyguy

توضیحات فارسی

@psyguy
psyguy / ess2016_selected.csv
Created August 25, 2019 10:56
Perceived discrimination, trust, and hope in political change in Europe 2016
We can't make this file beautiful and searchable because it's too large.
"cntry","dscrrce","dscrntn","dscrrlg","dscrlng","dscretn","dscrage","dscrgnd","dscrsex","dscrdsb","dscroth","ppltrst","pplfair","pplhlp","trstprl","trstlgl","trstplc","trstplt","trstprt","psppsgva","actrolga","psppipla","cptppola","polintr"
"AT",0,0,0,0,0,0,0,0,0,1,8,8,3,6,7,0,2,8,2,2,2,3,1
"AT",0,0,0,0,0,0,0,0,0,0,6,6,5,5,4,3,3,4,1,3,2,3,1
"AT",0,0,0,0,0,0,0,0,0,0,5,6,4,3,5,9,3,3,2,2,2,2,3
"AT",0,0,0,0,0,0,0,0,0,0,6,5,6,1,1,2,1,1,3,2,3,4,2
"AT",0,0,0,0,0,0,0,0,0,0,5,5,7,7,7,10,6,7,3,3,4,1,3
"AT",0,0,0,0,0,0,0,0,0,0,3,5,4,4,6,7,3,3,2,2,2,2,2
"AT",0,0,0,0,1,0,0,0,0,0,7,7,6,5,6,7,2,2,2,1,2,1,3
"AT",0,0,0,0,0,0,0,0,0,0,7,7,7,6,7,9,5,3,2,2,2,2,3
"AT",0,0,0,0,0,0,0,0,0,0,9,10,10,10,10,10,9,8,2,2,2,2,4
@psyguy
psyguy / SO - semPlot issue.R
Last active August 24, 2019 18:19
StackOverflow - 2910-08-24
# loading stuff -----------------------------------------------------------
list.of.packages <- c("tidyverse",
"plyr",
"qgraph",
"dplyr",
"knitr",
"kableExtra",
"psych",
"semPlot",