This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Consumer Sample for NATS | |
It creates a "durable pull consumer" named "TEST_DURABLE". | |
The consumer only listens to the "TEST.pushed" subject. | |
It prints the json messages pushed to the "TEST.pushed" subject.""" | |
import asyncio | |
import json | |
from nats.aio.client import Client as NATS | |
async def main(): | |
nc = NATS() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Export data from source postgresql database. | |
pg_dump --format=custom --no-owner --verbose --file=backup.dump "$SOURCE_URL" | |
# Restore the data to the target postgresql database. | |
pg_restore --clean --if-exists --no-owner --verbose --dbname="$TARGET_URL" backup.dump |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import redis | |
client = redis.StrictRedis( | |
host='hostname', | |
port=6379, | |
db=0, | |
password='password', | |
ssl=True, | |
ssl_cert_reqs=None | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bs4 | |
import csv | |
import requests | |
r = requests.get("https://www.n11.com/site-haritasi") | |
soup = bs4.BeautifulSoup(r.text, features="html.parser") | |
with open("kategoriler.csv", "w") as csvfile: | |
writer = csv.writer(csvfile, delimiter=';', quotechar='"') | |
mcs = [(a.text, a.get('href')) for a in soup.find_all("a", class_="main-category")] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This is a script for parsing polen levels in Madrid, Spain. | |
It used to work in 2019 but you may need to make fixes to make it work in the following years. | |
""" | |
import re | |
import locale | |
import time | |
import logging | |
import requests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package controllers | |
import ( | |
"github.com/revel/revel" | |
"fmt" | |
"time" | |
"gopkg.in/mgo.v2/bson" | |
"net/url" | |
"github.com/ChimeraCoder/anaconda" | |
"strconv" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# We have dataframe A with column name | |
# We have dataframe B with column name | |
# I want to see rows in A with name Y such that there exists rows in B with name Y. | |
# It's like set intersection. | |
intersected = reduce(lambda x, y: x | (A['name'] == y), [False] + list(B['name'])) | |
intersection = A[intersected] | |
# other alternatives | |
intersection = pd.merge(A, B, how='inner', on=['name']) | |
intersection.dropna(inplace=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#encoding: utf-8 | |
import math | |
ay = 1 | |
BM = {} | |
EK = {} | |
AGI = {} | |
SM = {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
uptodate () { | |
# returns 1 if up to date, 0 otherwise. | |
python /root/dropbox.py status | grep "Up to date" |wc -l | |
} | |
build_after_uptodate() { | |
while [ "$(uptodate)" != "1" ]; do | |
sleep 1 | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@[Link("igraph")] | |
@[Link("glpk")] | |
@[Link("stdarg")] | |
@[Link("c++")] | |
lib IGraph | |
VS_ALL = 0 | |
VS_ADJ = 1 | |
VS_NONE = 2 | |
VS_1 = 3 | |
VS_VECTORPTR = 4 |
NewerOlder