Skip to content

Instantly share code, notes, and snippets.

View edvm's full-sized avatar
:shipit:
FLDSMDFR

Emiliano Dalla Verde Marcozzi edvm

:shipit:
FLDSMDFR
View GitHub Profile
@edvm
edvm / gist:5b5cfabf9640fe0519a789d5722ed01f
Created December 3, 2020 18:35
Export all published wordpress posts with hero - featured images:
SELECT
display_name,
p1.*,
wm2.meta_value
FROM
wp_posts p1
LEFT JOIN
wp_users ON
wordpress.wp_users.ID=p1.post_author
@edvm
edvm / cjdns.sh
Created August 27, 2018 19:12 — forked from redraw/cjdns.sh
cjdns installer
#!/bin/bash
echo "installing..."
git clone https://github.com/cjdelisle/cjdns.git cjdns
cd cjdns/
./do
(umask 077 && ./cjdroute --genconf > cjdroute.conf)
sudo cp cjdroute /usr/bin
sudo cp cjdroute.conf /etc/
sudo wget https://raw.githubusercontent.com/cjdelisle/cjdns/master/contrib/systemd/cjdns.service -P /etc/systemd/system/
@edvm
edvm / gist:7ec7a8d449308200660e37b6b5b1a757
Created July 5, 2017 11:55
Doubts why elixir prints numbers inside lists as \t \n , etc
Interactive Elixir (1.4.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> [1, 2]
[1, 2]
iex(2)> [9, 10, 2]
[9, 10, 2]
iex(3)> [9, 10]
'\t\n' <-- Whops! Unexpected!
# 1. Create a Python function that gets an integer between 1 - 12 (as an hour) and returns the exact time in hours
# and minutes at which the hands of the clock overlap at this hour
# (for example, for 1, the result will be close to 1:06)
# 2. create a unit test for this function, using 'assert', or the Python 'unittest' framework
# 3. [BONUS]
# a. add also seconds calculation to the return value of the function.
# b. calculate the angle of the hands in 360 degrees system
# taking 12:00 (noon, midnight) as a point of reference
# ATTENTION: You do not need to import any modules to implement this task
package main
import "fmt"
func keys(m map[string]int) ([]string, int) {
var keys = []string{}
var c int = 0
for key, _ := range m {
keys = append(keys, key)
c += 1
package main
import "fmt"
func sum(slice *[]int) int {
total := 0
for _, val := range *slice {
total += val
}
return total
from application.notifications import notify_hipchat
from django.core.cache import cache
from django.utils import timezone
from contextlib import contextmanager
class TaskHandler(object):
def __init__(self, name='celery-tasks', cache=cache):
"""TaskHandler
21:02:40-edvm~$ netstat -n | grep ESTABLISHED
tcp 0 0 192.168.0.12:44564 200.42.3.142:443 ESTABLISHED
tcp 0 0 192.168.0.12:44500 200.42.3.142:443 ESTABLISHED
tcp 0 0 192.168.0.12:39712 181.30.241.226:443 ESTABLISHED
tcp 0 0 192.168.0.12:43414 181.30.242.114:443 ESTABLISHED
tcp 0 0 192.168.0.12:44558 200.42.3.142:443 ESTABLISHED
tcp 0 0 192.168.0.12:44556 200.42.3.142:443 ESTABLISHED
tcp 0 0 192.168.0.12:44560 200.42.3.142:443 ESTABLISHED
tcp 0 0 192.168.0.12:41802 173.194.42.206:443 ESTABLISHED
tcp 0 0 192.168.0.12:39714 181.30.241.226:443 ESTABLISHED
20:56:00-edvm~/Work/bomberos.ar/app/baseapp/static (develop)$ cat ~/salida
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 1 192.168.0.12:36542 192.168.0.29:33031 SYN_SENT
tcp 0 0 192.168.0.12:54900 181.30.242.84:443 ESTABLISHED
tcp 0 0 192.168.0.12:52610 50.16.248.164:443 ESTABLISHED
tcp 0 1 192.168.0.12:39402 192.168.0.29:37210 SYN_SENT
tcp 0 0 192.168.0.12:49924 64.233.186.113:443 ESTABLISHED
tcp 0 1 192.168.0.12:44746 192.168.0.29:33180 SYN_SENT
tcp 0 1 192.168.0.12:44730 192.168.0.29:33180 SYN_SENT
@edvm
edvm / log_sql.py
Created October 8, 2015 17:41 — forked from pardo/log_sql.py
Log sql to terminal django app
import logging
l = logging.getLogger('django.db.backends')
l.setLevel(logging.DEBUG)
l.addHandler(logging.StreamHandler())