Skip to content

Instantly share code, notes, and snippets.

View panchicore's full-sized avatar
👽

Luis Pallares panchicore

👽
View GitHub Profile
@rain-1
rain-1 / LLM.md
Last active July 3, 2024 15:04
LLM Introduction: Learn Language Models

Purpose

Bootstrap knowledge of LLMs ASAP. With a bias/focus to GPT.

Avoid being a link dump. Try to provide only valuable well tuned information.

Prelude

Neural network links before starting with transformers.

@edelooff
edelooff / sqla_secondary.py
Created April 24, 2020 09:14
SQLAlchemy secondary join
from sqlalchemy import (
Column,
ForeignKey,
Integer,
Text,
create_engine)
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import (
relationship,
sessionmaker)
@panchicore
panchicore / examples.md
Created July 18, 2017 07:23
Scripted fields

My Scripted Fields with Kibana

Dates

Get the year

doc['incident_date'].date.year

Calculating difference in days between 2 dates

(doc['report_date'].date.getMillis() - doc['incident_date'].date.getMillis()) / 1000 / 60 / 60 / 24

How to setup AWS lambda function to talk to the internet and VPC

I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.

So it might be really unintuitive at first but lambda functions have three states.

  1. No VPC, where it can talk openly to the web, but can't talk to any of your AWS services.
  2. VPC, the default setting where the lambda function can talk to your AWS services but can't talk to the web.
  3. VPC with NAT, The best of both worlds, AWS services and web.
@IamAdiSri
IamAdiSri / Python3, Pip3, Virtualenv and Virtualenvwrapper Setup
Last active May 9, 2022 22:08 — forked from evansneath/Python3 Virtualenv Setup
Setting up and using Python3, Pip3, Virtualenv (for Python3) and Virtualenvwrapper (for Python3)
First install pip for Python2. Download the get-pip.py file from https://bootstrap.pypa.io/get-pip.py
$ cd <download location>
$ sudo -H python ./get-pip.py
Installing pip also installs Python3
To run Python3
$ python3
Install pip3 by just executing the same file as in the step above, but this time using Python3
$ sudo -H python3 ./get-pip.py
@gene1wood
gene1wood / all_aws_lambda_modules_python.md
Last active May 25, 2024 20:06
AWS Lambda function to list all available Python modules for Python 2.7 3.6 and 3.7
@bkurzius
bkurzius / CircularNetworkImageView
Last active September 21, 2020 16:18
Circular NetworkImageView for use with Volley. Creates a circular bitmap and uses whichever dimension is smaller to determine the radius. Also constrains the circle to the leftmost part of that image. Used in the same way as the Volley NetworkImageView, in both code and xml. Of course you'll need to include the Volley Library in you app too.
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Bitmap.Config;
import android.graphics.PorterDuff.Mode;
import android.graphics.drawable.BitmapDrawable;
@joshdholtz
joshdholtz / SomeFragment.java
Last active December 22, 2022 09:41
Android Google Maps V2 - MapView in XML
public class SomeFragment extends Fragment {
MapView mapView;
GoogleMap map;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.some_layout, container, false);
@cristiangrojas
cristiangrojas / custom jquery ui autocomplete
Created October 11, 2012 18:55
I'm using this custom autocomplete for actualito.com
$(function(){
$.widget('custom.actualito_autocomplete', $.ui.autocomplete, {
_renderMenu: function(ul, items){
var that = this,
currencyCategory = '';
$.each(items, function(index, item){
if(item.type != currencyCategory){
ul.append( "<li class='ui-autocomplete-category list_item_container filter'>" + item.type + "</li>" );
currencyCategory = item.type;
}
@bohde
bohde / resources.py
Created July 6, 2011 13:07
Tastypie support for Geodjango distance filtering
class MyGeoResource(Resource):
def apply_sorting(self, objects, options=None):
if options and "longitude" in options and "latitude" in options:
return objects.distance(Point(options['latitude'], options['longitude'])).order_by('distance')
return super(MyGeoResource, self).apply_sorting(objects, options)