Skip to content

Instantly share code, notes, and snippets.

View scanterog's full-sized avatar

Samuel Cantero scanterog

View GitHub Profile
@scanterog
scanterog / Dockerfile
Last active August 7, 2017 02:34
www-rebuilder
FROM python:2.7
RUN apt-get update -qqy; \
apt-get install -qqy \
ruby \
ruby-dev \
rubygems; \
apt-get clean -qqy;
RUN gem install jekyll
@scanterog
scanterog / task_priority.py
Last active August 10, 2017 23:22
Test number of tasks in a Queue with Redis as a broker
import threading
from tasks import add
for i in reversed(range(10)):
add.apply_async((0, i), priority=i)
# Redis should list multiple queues like this:
# 127.0.0.1:6379[3]> keys *
# 1) "_kombu.binding.celeryev"
# 2) "default\x06\x163" ====> 3
mv 4024 org.laptop.WebActivity
mv 4026 org.laptop.community.TypingTurtle
mv 4027 org.laptop.TurtleArtActivity
mv 4028 org.laptop.sugar.ReadActivity
mv 4029 org.sugarlabs.IRC
mv 4030 org.vpri.EtoysActivity
mv 4031 com.martindengler.WirelessGraph
mv 4032 org.laptop.ImageViewerActivity
mv 4034 com.garycmartin.Moon
mv 4035 org.laptop.sugar.ReadEtextsActivity
@scanterog
scanterog / install.sh
Created September 8, 2017 17:07
Install and configure Talk
#!/bin/sh
TALK_VERSION=3.4.0
TALK_BASEDIR=/opt/talk
TALK_ROOT_URL=http://your-domain.tld
#mongo repo
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.2.list
import os
from aiohttp import web
async def build():
os.system('git pull')
os.system('rm -rf doc')
os.system('/docker/docker -I -c default --extras addHeader,noFiles'
' -x node_modules')
os.system('cp -r images doc')
print("Building has finished!")
@scanterog
scanterog / a_checks.py
Last active October 3, 2017 20:07
Check app status in servers and add/remove accordingly
import sys
import argparse
import redis
import json
import requests
def parse_arguments():
parser = argparse.ArgumentParser(description='')
parser.add_argument(
{
"redis": {
"host": "127.0.0.1",
"port": 6379,
"db": 0,
"password": ""
},
"aws": {
"access_key_id": "<access>",
"secret_access_key": "<secret>",
@scanterog
scanterog / killsnoop.bt
Created May 14, 2019 21:23
killsnoop.bt
#!/usr/bin/env bpftrace
/*
* killsnoop Trace signals issued by the kill() syscall.
* For Linux, uses bpftrace and eBPF.
*
* USAGE: killsnoop.bt
*
* Also a basic example of bpftrace.
*
* This is a bpftrace version of the bcc tool of the same name.
2,3c2
< int AVX3Threshold = 4096 {ARCH diagnostic} {default}
< bool AbortVMOnCompilationFailure = false {diagnostic} {default}
---
> ccstrlist AOTLibrary = {product} {default}
6,8d4
< bool AbortVMOnSafepointTimeout = false {diagnostic} {default}
< bool AbortVMOnVMOperationTimeout = false {diagnostic} {default}
< intx AbortVMOnVMOperationTimeoutDelay = 1000 {diagnostic} {default}
67c63
@scanterog
scanterog / main.go
Created November 2, 2020 14:48
static assignment
package main
import (
"fmt"
"log"
"os"
"os/signal"
"strconv"
"syscall"