Skip to content

Instantly share code, notes, and snippets.

@edariedl
edariedl / gist:a1c35eb68aebdf41876c
Last active May 7, 2024 08:30
Bulk delete of documents from Elasticsearch in Ruby on Rails

Bulk delete of documents from Elasticsearch in Ruby on Rails

When someone deletes his account we need to delete data from the elasticsearch. All account data are removed by bulk SQL query but elasticsearch-model cannot be notified to destroy related elasticsearch documents. I had to find out how to do it. It had to be done in the background job otherwise it could take too long.

After looking around in the source code of elasticsearch ruby gems, Elastcisearch API and with a little help from Karmi (author of elasticsearch gems) I found a solution. It consists of the following three things.

@dimasch
dimasch / redis-clear
Last active May 7, 2024 08:29
Clear a redis cache in Docker
docker exec -it container-name redis-cli FLUSHALL
@aymericbeaumet
aymericbeaumet / delete-likes-from-twitter.md
Last active May 7, 2024 08:28
[Recipe] Delete all your likes/favorites from Twitter

Ever wanted to delete all your likes/favorites from Twitter but only found broken/expensive tools? You are in the right place.

  1. Go to: https://twitter.com/{username}/likes
  2. Open the console and run the following JavaScript code:
setInterval(() => {
  for (const d of document.querySelectorAll('div[data-testid="unlike"]')) {
    d.click()
 }
@kenmori
kenmori / TypeScriptPractice.md
Last active May 7, 2024 08:28
TypeScript 練習問題集
@dimmduh
dimmduh / run.sh
Created February 6, 2018 03:30
How to update gitlab - ubuntu 16 - whne package 'gitlab-ce' has no installation candidate
copy text from
https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/config_file.list?os=Ubuntu&dist=xenial&source=script
put to
nano /etc/apt/sources.list.d/gitlab_gitlab-ce.list
update
gitlab-rake gitlab:backup:create STRATEGY=copy
apt-get update && sudo apt-get install gitlab-ce
@m-jovanovic
m-jovanovic / .editorconfig
Created June 7, 2023 12:17
Sample editor config with a bunch of rules turned off 😅
root = true
# C# files
[*.cs]
#### Core EditorConfig Options ####
# Indentation and spacing
indent_size = 4
indent_style = space
<?php
/*
* qtfaststart.php v0.1 by Valentin Schmidt
* based on qt-faststart.c v0.2 by Mike Melanson (melanson@pcisys.net)
*
* This file is placed in the public domain. Use the program however you
* see fit.
*
* This utility rearranges a Quicktime file such that the moov atom
* is in front of the data, thus facilitating network streaming.
public class Throttler {
private let queue: DispatchQueue = DispatchQueue.global(qos: .background)
private var job: DispatchWorkItem = DispatchWorkItem(block: {})
private var previousRun: Date = Date.distantPast
private var maxInterval: TimeInterval
public init(maxInterval: TimeInterval) {
self.maxInterval = maxInterval
@Emmanuerl
Emmanuerl / awk.MD
Created May 5, 2024 16:05
Backend study group AWK hands on session

The AWK CLI Tool

A step by step introduction into the AWK command, it's syntax, uses and sample use cases.

Introduction

The awk command is a column based manipulation tool that can be used for a variety of things, from reading CSVs to killing processes, literally. At the very core, AWK is based on the following awk '{expression to qualify output} {print $output expression}' Although it's a cli tool, it offers a lot of programming language paradigms such as