Skip to content

Instantly share code, notes, and snippets.

View antikytheraton's full-sized avatar
💻
configuring nvim

Aaron Arredondo antikytheraton

💻
configuring nvim
View GitHub Profile
@antikytheraton
antikytheraton / oscilloscope.c
Created June 2, 2017 10:19 — forked from chrismeyersfsu/oscilloscope.c
Arduino Poor man's oscilloscope processing code
/*
* Oscilloscope
* Gives a visual rendering of analog pin 0 in realtime.
*
* This project is part of Accrochages
* See http://accrochages.drone.ws
*
* (c) 2008 Sofian Audry (info@sofianaudry.com)
*
* This program is free software: you can redistribute it and/or modify
@antikytheraton
antikytheraton / skeleton-daemon.sh
Created June 29, 2017 19:11 — forked from shawnrice/skeleton-daemon.sh
A template to write a quick daemon as a bash script
#!/bin/sh
# This is a skeleton of a bash daemon. To use for yourself, just set the
# daemonName variable and then enter in the commands to run in the doCommands
# function. Modify the variables just below to fit your preference.
daemonName="DAEMON-NAME"
pidDir="."
pidFile="$pidDir/$daemonName.pid"
@antikytheraton
antikytheraton / gist:e29ab4c598f8d070b78dab489396f80f
Created September 7, 2017 18:14 — forked from econchick/gist:4666413
Python implementation of Dijkstra's Algorithm
class Graph:
def __init__(self):
self.nodes = set()
self.edges = defaultdict(list)
self.distances = {}
def add_node(self, value):
self.nodes.add(value)
def add_edge(self, from_node, to_node, distance):
@antikytheraton
antikytheraton / gist:a35b87b7ec7845e0d71a047a6208e217
Created November 24, 2017 01:14 — forked from cdrx/gist:6952891
Django user registration with a custom user model via a Django REST Framework request
from django.contrib.auth import get_user_model
from rest_framework import status, serializers
from rest_framework.decorators import api_view
from rest_framework.response import Response
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = get_user_model()
#!/home/drspock/scripts/FBInvite/bin/python
import argparse
import requests
import pyquery
def login(session, email, password):
'''
Attempt to login to Facebook. Returns user ID, xs token and
@antikytheraton
antikytheraton / fblogin.py
Created December 8, 2017 21:46 — forked from chm0815/fblogin.py
Facebook Login Script
import sys, urllib, urllib2, cookielib
class FacebookLogin(object):
def __init__(self,user,passw):
self.user=user
self.passw=passw
self.browser = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookielib.CookieJar()))
self.browser.addheaders=[('User-agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20100101 Firefox/6.0')]
urllib2.install_opener(self.browser)
@antikytheraton
antikytheraton / fblogin_test.py
Created December 8, 2017 21:49 — forked from adoc/fblogin_test.py
py: Simple facebook login
import os
import base64
import flask
import urllib.parse
import requests
app = flask.Flask(__name__)
APP_ID = "ID"
APP_SECRET = "SECRET"
@antikytheraton
antikytheraton / 01_utils.py
Created July 12, 2018 14:46 — forked from mbrochh/01_utils.py
Using pagination with Django, graphene and Apollo
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
# First we create a little helper function, becase we will potentially have many PaginatedTypes
# and we will potentially want to turn many querysets into paginated results:
def get_paginator(qs, page_size, page, paginated_type, **kwargs):
p = Paginator(qs, page_size)
try:
page_obj = p.page(page)
except PageNotAnInteger:
@antikytheraton
antikytheraton / 4956984-1.py
Created March 5, 2019 00:34 — forked from miku/4956984-1.py
How do you split a csv file into evenly sized chunks in Python?
#!/usr/bin/env python
# import csv
# reader = csv.reader(open('4956984.csv', 'rb'))
def gen_chunks(reader, chunksize=100):
"""
Chunk generator. Take a CSV `reader` and yield
`chunksize` sized slices.
"""
@antikytheraton
antikytheraton / install-docker-master.sh
Created March 5, 2019 17:16 — forked from alexellis/install-docker-master.sh
install docker engine for swarm3k on Ubuntu 16.04. 2 options for installing
#!/bin/sh
# option 2: paste this into user-data to automate install via boot script
# NOTE: update --label=owner=YOURNAME below if you want to easily identify yours
# renames the host to have a suffix of alexellisio
export original=$(cat /etc/hostname)
sudo hostname $original-master-alexellisio
echo $original-master-alexellisio | sudo tee /etc/hostname
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D