Skip to content

Instantly share code, notes, and snippets.

@clupasq
clupasq / download_whatsapp_images.js
Last active April 23, 2024 15:09
This is a small JS script that automatically downloads all the images in a WhatsApp conversation
// Script to download images from WhatsApp
//
// Steps to use:
// 1. Open up the conversation you want to download pics from
// 2. Open the leftmost image you want to download (the script
// will download and advance to the next image until the last
// image is reached.
// 3. Open the developer console and paste the script in it
// 4. Click OK on the "Download multiple files" browser prompt
// (if it appears)
@clupasq
clupasq / nlog colored console files
Created March 13, 2012 08:52
nlog configuration for colored console + info&error files
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="coloredConsole" xsi:type="ColoredConsole" useDefaultRowHighlightingRules="false"
layout="${longdate}|${pad:padding=5:inner=${level:uppercase=true}}|${message}" >
<highlight-row condition="level == LogLevel.Debug" foregroundColor="DarkGray" />
<highlight-row condition="level == LogLevel.Info" foregroundColor="Gray" />
<highlight-row condition="level == LogLevel.Warn" foregroundColor="Yellow" />
@clupasq
clupasq / compute_exercise.py
Created January 16, 2021 13:45
[RO][4kids] Python script to only run an app if some equations are first solved.
# Usage:
#
# Run `some_app` only if 10 math puzzles are solved first:
# python3 compute_exercise.py && some_app
#
# Only 7 puzzles instead of the default 10:
# python3 compute_exercise.py 7 && some_app
#
# Only 5 puzzles, but force exit after 10min:
# python3 compute_exercise.py 5 && timeout 600 some_app
@clupasq
clupasq / codio_init.sh
Last active July 20, 2020 21:09
Codio init
cd ~
mkdir -p ~/.config
sudo apt-get install -y inotify-tools
sudo apt-get install -y tmux
git clone https://github.com/clupasq/clupasq.git $HOME/.config/clupasq
$HOME/.config/clupasq/setup.sh -o
p = self.spawnpos()
str="THIS IS THE MESSAGE!"
isx = 1
isz = 0
dir = -1
for i = 1, #str do
local c = str:sub(i,i)
@clupasq
clupasq / timeout.cs
Created September 4, 2012 12:34
C# Timeout implementation
[Test]
public void ComputeResultWithTimeout()
{
var task = Task.Factory.StartNew(() => ComputeResult("bla"));
//task.Wait(0999);
task.Wait(1000);
if (task.IsCompleted)
Console.WriteLine("OK, got: " + task.Result);
setxkbmap -option caps:escape,shift:both_capslock
require 'rspec/autorun'
require 'json'
require 'httparty'
require 'pp'
GuessResult = Struct.new :x, :y, :count
class FakeGame
def initialize(x=random_num, y=random_num)
@x = x
x `shouldBe` y = putStrLn $ if x == y then "OK" else "Not OK!"
@clupasq
clupasq / searchObject.js
Created October 12, 2017 14:21
Search using a regex inside a deeply nested JS Object
var searchObject = function(o, expr, callback, path, visited) {
try{
visited = visited || new Set();
path = path || '';
if (visited.has(o)) { return; }
if (!o) { return; }
visited.add(o);
if (typeof o === 'string') {
if (o.match(expr)) {
callback(path);