Skip to content

Instantly share code, notes, and snippets.

@clupasq
clupasq / compute_exercise.py
Created Jan 16, 2021
[RO][4kids] Python script to only run an app if some equations are first solved.
View compute_exercise.py
# 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
View minetest_basic_robot_write_message.lua
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)
View setxkbmap_keyboard_setup.sh
setxkbmap -option caps:escape,shift:both_capslock
View easter_egg.rb
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
View shouldBe.hs
x `shouldBe` y = putStrLn $ if x == y then "OK" else "Not OK!"
@clupasq
clupasq / searchObject.js
Created Oct 12, 2017
Search using a regex inside a deeply nested JS Object
View searchObject.js
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);
@clupasq
clupasq / download_whatsapp_images.js
Created Sep 25, 2017
This is a small JS script that automatically downloads all the images in a WhatsApp conversation
View download_whatsapp_images.js
// 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)
View centod_init.sh
ssh-keygen -t rsa -b 4096
cd .ssh/
touch authorized_keys
chmod 644 authorized_keys
sudo yum update
sudo yum install bash-completion
sudo yum install epel-release
sudo yum install git
mkdir -p ~/.config
sudo yum install inotify-tools tmux htop
@clupasq
clupasq / supercrazy.lua
Created May 19, 2017
Super crazy Blobby Volley rules - before each serve, the game switches to a random mode between Jumping Jack, Sticky or Default
View supercrazy.lua
__AUTHOR__ = "wolf & radu"
__TITLE__ = "Super Crazy"
-- Based on two other game modes by chameleon: Jumping Jack and Sticky Mode
mode = "default"
function randomize()
x = math.random(1,3)
if x == 1 then mode = "default"
elseif x == 2 then mode = "jumping"
View dynamically_add_datatables.js
// Run this script on any page to load the DataTables library
// (https://datatables.net/)
// and add DataTable functionality to all tables
var addJqueryIfNotPresent = function(callback){
if(!window.jQuery){
var scr = document.createElement('script');
scr.src = 'https://code.jquery.com/jquery-2.2.4.min.js';
scr.onload = function(){ callback && callback(); };
document.head.appendChild(scr);