Skip to content

Instantly share code, notes, and snippets.

View foobarna's full-sized avatar

Bogdan Barna foobarna

View GitHub Profile
@vincentclaes
vincentclaes / login-to-stackoverflow.py
Last active April 22, 2023 11:40
Schedule an AWS lambda with python 3.8 to run each day and logs in to stackoverflow. Put your email ("EMAIL") and password ("PASS") in the environment variables. lf you visit https://stackoverflow.com/ for 30 consecutive days, you can earn Enthusiast badge. And 100 days, Fanatic badge.
import os
import re
import datetime
import json
import urllib3
from urllib.parse import urlencode
def lambda_handler(event, context):
stack_overflow = StackOverflow()
@fabiolimace
fabiolimace / UUIDv6.sql
Last active July 20, 2024 00:23
Functions for generating UUIDv6 and UUIDv7 on PostgreSQL
/*
* MIT License
*
* Copyright (c) 2023-2024 Fabio Lima
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
This file has been truncated, but you can view the full file.
[{"MatchId":"match.bro.official.2018-03.na.squad.2018.03.12.d6f1b510-ef2c-449b-bc14-bd1013e574d7","PingQuality":"high","_V":2,"_D":"2018-03-12T17:41:34.9258314+00:00","_U":false,"_T":"LogMatchDefinition"},{"result":true,"errorMessage":"","accountId":"account.56492847c97d4faaac19c608d0c34e71","_V":2,"_D":"2018-03-12T17:40:24.253Z","_T":"LogPlayerLogin","_U":false},{"character":{"name":"M4A1-SSSSSSSSSSS","teamId":2,"health":100,"location":{"x":82904.359375,"y":730169.625,"z":5170.15234375},"ranking":0,"accountId":"account.56492847c97d4faaac19c608d0c34e71"},"_V":2,"_D":"2018-03-12T17:40:24.274Z","_T":"LogPlayerCreate","_U":false},{"result":true,"errorMessage":"","accountId":"account.97335609ab2f4dcf905c4d5f5a91e866","_V":2,"_D":"2018-03-12T17:40:24.274Z","_T":"LogPlayerLogin","_U":false},{"character":{"name":"wang0716","teamId":3,"health":100,"location":{"x":128396.28125,"y":24700.220703125,"z":3550.19873046875},"ranking":0,"accountId":"account.97335609ab2f4dcf905c4d5f5a91e866"},"_V":2,"_D":"2018-03-12T17:40:24.
{% if is_paginated %}
{% load proper_paginate %}
{% load url_replace %}
<ul class="pagination">
{% if page_obj.number == 1 %}
<li class="disabled"><span>⇤</span></li>
{% else %}
<li><a class="page-link" href="?{% url_replace request 'page' 1 %}">⇤</a></li>
{% endif %}
{% if page_obj.has_previous %}
@aparrish
aparrish / understanding-word-vectors.ipynb
Last active July 9, 2024 15:59
Understanding word vectors: A tutorial for "Reading and Writing Electronic Text," a class I teach at ITP. (Python 2.7) Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pjobson
pjobson / remove_mcafee.md
Last active March 26, 2024 04:26
OSX McAfee Removal

Removal of McAfee from OSX

Note: This was written in 2015, it may be out of date now.

There are a lot of commands here which I use sudo if you don't know what you're doing with sudo, especially where I rm you can severely screw up your system.

There are many reasons which you would want to remove a piece of software such as McAfee, such as not wanting it to hammer your CPU during work hours which seems like primetime for a virus scan.

I intend this to be a living document, I have included suggestions from peoples' replies.

#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
@davewongillies
davewongillies / Serving Django apps behind SSL with Nginx.md
Last active August 28, 2022 17:31 — forked from aj-justo/gist:3228782
Serving Django apps behind SSL with Nginx

Configuring Nginx to serve SSL content is straight forward, once you have your certificate and key ready:

server { 
    listen 443 default ssl;
    root /path/to/source;
    server_name mydomain;

    ssl_certificate      /path/to/cert;
    ssl_certificate_key  /path/to/key;
@phette23
phette23 / current-dir-in-iterm-tab-title.sh
Last active June 4, 2024 01:52
Set the iTerm tab title to the current directory, not full path.
# put this in your .bash_profile
if [ $ITERM_SESSION_ID ]; then
export PROMPT_COMMAND='echo -ne "\033];${PWD##*/}\007"; ':"$PROMPT_COMMAND";
fi
# Piece-by-Piece Explanation:
# the if condition makes sure we only screw with $PROMPT_COMMAND if we're in an iTerm environment
# iTerm happens to give each session a unique $ITERM_SESSION_ID we can use, $ITERM_PROFILE is an option too
# the $PROMPT_COMMAND environment variable is executed every time a command is run
# see: ss64.com/bash/syntax-prompt.html