Skip to content

Instantly share code, notes, and snippets.

account_list = ["GiuseppeConteIT","luigidimaio","nzingaretti","matteorenzi","GiorgiaMeloni","matteosalvinimi","CarloCalenda","berlusconi","civati"]
consumer_key = 'INSERT YOUR KEY HERE'
consumer_secret = 'INSERT YOUR SECRET HERE'
access_token = 'INSERT YOUR ACCESS TOKEN HERE'
access_secret = 'INSERT YOUR ACCESS SECRET HERE'
auth = OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_secret)
api = tweepy.API(auth, wait_on_rate_limit=True)
from datetime import datetime, date, time, timedelta
import pymysql
import tweepy
from tweepy import OAuthHandler
from collections import Counter
function exists_email($email) {
if (!isset($email)) {
return true;
}
try {
$query = $this->db->prepare("SELECT id FROM subscribers WHERE email_hash=?");
$data = Array($email);
$query->execute($data);
$all_mails = $query->fetchAll();
foreach($all_mails as $row) {
// check if mail already exists
$email_hash = $dao->getBlindIndex($email);
if ($dao->exists_email($email_hash)) {
header("location: index.php?e=email_exists");
exit();
}
// check if phone already exists
$phone_hash = $dao->getBlindIndex($phone);
if ($dao->exists_phone($phone_hash)) {
@lamorbidamacchina
lamorbidamacchina / index.html
Created November 1, 2019 21:13
Pure CSS horizontal bar chart with staggering animation
<div class="skills">
<ul class="lines">
<li class="line l--0">
<span class="line__label title">
Skill level:
</span>
</li>
<li class="line l--25">
<span class="line__label">
The basics
<td>
<span class="moreinfo" data-toggle="tooltip" title="string stored in database:<?php echo $row['email'];?>">
<?php echo $dao->dec($row['email']);?>
</span>
</td>
<td>
<span class="moreinfo" data-toggle="tooltip" title="string stored in database: <?php echo $row['phone'];?>">
<?php echo $dao->dec($row['phone']);?>
</span>
</td>
<?php
public function dec($string) {
$decoded = base64_decode($string);
$key = base64_decode($this->key);
$nonce = mb_substr($decoded, 0, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, '8bit');
$ciphertext = mb_substr($decoded, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, null, '8bit');
try {
$plaintext = sodium_crypto_secretbox_open($ciphertext, $nonce, $key);
return $plaintext;
}
<?php
function insert($first_name,$last_name,$email,$phone,$privacy,$source,$ip) {
if ($first_name.''=='' || $last_name.'' == '' || $email.'' == '' || $phone.'' == '' || $privacy.'' == '') {
return false;
}
else {
// create blind index for encrypted searchable fields
$email_hash = $this->getBlindIndex($email);
$phone_hash = $this->getBlindIndex($phone);
// get key for encryption
<?php
public function getBlindIndex($string)
{
$index_key = base64_decode($this->index_key);
return bin2hex(
sodium_crypto_pwhash(
32,
$string,
$index_key,
SODIUM_CRYPTO_PWHASH_OPSLIMIT_MODERATE,