Skip to content

Instantly share code, notes, and snippets.

View rdlmda's full-sized avatar

Rudá Almeida rdlmda

  • Federal University of Rio de Janeiro
  • Rio de Janeiro, Brazil
  • 05:11 (UTC -03:00)
View GitHub Profile
@haasn
haasn / about:config.md
Last active September 25, 2025 20:46
Firefox bullshit removal via about:config

Firefox bullshit removal

Updated: Just use qutebrowser (and disable javascript). The web is done for.

@georgy7
georgy7 / extract_mbox_attachments.py
Last active October 20, 2025 08:06
Extract attachments from mbox file.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Modified.
# Original script source:
# http://blog.marcbelmont.com/2012/10/script-to-extract-email-attachments.html
# https://web.archive.org/web/20150312172727/http://blog.marcbelmont.com/2012/10/script-to-extract-email-attachments.html
# Usage:
# Run the script from a folder with file "all.mbox"
-- delete any usermeta specific to the other subsites
delete from wp_usermeta where meta_key regexp '^wp_([0-9]+)_';
-- duplicate the wp_usermeta structure in a working data table,
-- but add a unique index for filtering out duplicates
create table _fix_usermeta like wp_usermeta;
alter table _fix_usermeta add unique(user_id, meta_key);
-- copy the site-specific usermeta, keeping only the last of each duplicate
insert into _fix_usermeta
@revolunet
revolunet / backup.py
Last active October 14, 2022 22:12
download your google drive files with python
# -*- encoding: UTF-8 -*-
import os
import httplib2
# pip install --upgrade google-api-python-client
from oauth2client.file import Storage
from apiclient.discovery import build
from oauth2client.client import OAuth2WebServerFlow
@vedant
vedant / gist:9333992
Last active September 26, 2024 01:23
Export note files from Google Keep
/* Vedant Misra (vedantmisra.com) (github.com/vedant)
*
* Script for exporting Google Keep note files.
*
* This does not handle attachments or checklists, only note files. Downloads
* each note to a .txt file named for the note's title.
*
* To use this, go to https://drive.google.com/keep/ and wait for the page to
* fully load all of your saved notes; scroll to the bottom to confirm they're
* loaded. Then paste the below in your URI bar, go to the start of the line,
@gitaarik
gitaarik / git_submodules.md
Last active November 6, 2025 22:10
Git Submodules basic explanation

Git Submodules - Basic Explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a sub-repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:

  • Separate big codebases into multiple repositories.
@johnReeve
johnReeve / custom.php
Created December 4, 2013 18:08
How I do my WordPRess site specific configuration fields
<?php
/* setup custom general settings */
function ts_theme_settings () {
register_setting( 'general', 'homepage_slider_wide' );
add_settings_field(
'homepage_slider_wide',
'Homepage Slider (Wide)',
'homepage_slider_wide_callback',
@claudiosanches
claudiosanches / functions.php
Last active March 8, 2017 16:26
WordPress - Last posts with ajax.
<?php
function cs_last_posts_json() {
$json = array();
$last_posts = get_posts( array(
'posts_per_page' => 5,
'post_type' => 'post'
) );
foreach ( $last_posts as $post ) {
@claudiosanches
claudiosanches / index.html
Last active December 27, 2015 11:29
Get feed with jQuery
<!DOCTYPE html>
<html>
<head>
<title>Feed</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
</head>
<body>
<script>
jQuery(document).ready(function($) {
var url = 'http://claudiosmweb.com/feed/',
@neverything
neverything / functions.php
Last active December 10, 2023 02:22
WordPress: pre_get_posts filter to display one post per category. Displays the latest sticky post and therefore excludes the category of the sticky post as we only want one post per category.
<?php
/**
* Main Query for the Front Page
*
* Display the latest post per category. The latest sticky post goes to the
* top. It's category is then excluded as we only want 1 post per category.
*
* @param object $query WP_Query
*/
function sh_pre_get_posts_front_page( $query ) {