This file contains 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
#!/usr/bin/python | |
import json | |
import datetime | |
import httplib | |
import urllib | |
import sys | |
from tweepy import Stream, OAuthHandler | |
from tweepy.streaming import StreamListener |
This file contains 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
''' | |
Search dictionary d containing other dictionaries or lists recursively for a specified key k with value v | |
dict d: Dictionary to search through | |
string k: Key to search for | |
object v: Value the key shall have | |
''' | |
def search_key_value(d, k, v): | |
if isinstance(d, dict): | |
for key, value in d.iteritems(): |
This file contains 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
# Assuming you are running Apache2 and managing the certificates yourself | |
certbot-auto renew --standalone --non-interactive -m [email protected] --force-renewal --agree-tos --no-self-upgrade --pre-hook "service apache2 stop" --post-hook "service apache2 start" --quiet |
This file contains 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 argparse | |
parser = argparse.ArgumentParser(description='Combines Let\'s Encrypt certificate to a fully PEM certificate file to use with LiveConfig.') | |
parser.add_argument('private_key', action='store', help='Path to private key file') | |
parser.add_argument('full_chain', action='store', help='Path to full chain certificate file') | |
parser.add_argument('output', action='store', help='Output file for combined PEM certificate') | |
args = parser.parse_args() | |
try: |
This file contains 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
<?php | |
public function up() | |
{ | |
Schema::create('users', function (Blueprint $table) { | |
// Default Laravel stuff | |
$table->increments('id'); | |
$table->string('name'); | |
$table->string('email')->unique(); | |
$table->string('password'); |
This file contains 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
<?php | |
// [...] | |
/** | |
* Generate a random hexadecimal token by hashing the current time in microseconds as float | |
* | |
* @return string Random 32-characters long hexadecimal token | |
*/ | |
public static function generateToken() { |
This file contains 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
<?php | |
// [...] | |
/** | |
* The attributes that are mass assignable. | |
* | |
* @var array | |
*/ | |
protected $fillable = [ |
This file contains 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
<?php | |
// [...] | |
/** | |
* Perform the confirmation of the user's e-mail address. | |
* | |
* @param User $user The provided user instance | |
* @param $token string The provided confirmation token | |
* @return mixed |
This file contains 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
<?php | |
// [...] | |
Route::get('users/{user}/{token}/confirm', 'Auth\\RegisterController@confirm')->name('confirm'); | |
// [...] |
This file contains 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
<?php | |
// [...] | |
/** | |
* Create a new user instance after a valid registration. | |
* | |
* @param array $data | |
* @return \App\User | |
*/ |
OlderNewer