Skip to content

Instantly share code, notes, and snippets.

View karlicoss's full-sized avatar
🌴
🐰

karlicoss

🌴
🐰
View GitHub Profile
// CS124 HW1 SpamLord
import java.util.regex.*;
import java.util.Collections;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import java.util.Set;
import java.util.HashSet;
import java.io.*;
@0xjjpa
0xjjpa / chrome.md
Created December 9, 2012 04:37
Understanding Google Chrome Extensions

#Introduction

Developing Chrome Extensions is REALLY fun if you are a Front End engineer. If you, however, struggle with visualizing the architecture of an application, then developing a Chrome Extension is going to bite your butt multiple times due the amount of excessive components the extension works with. Here are some pointers in how to start, what problems I encounter and how to avoid them.

Note: I'm not covering chrome package apps, which although similar, work in a different way. I also won't cover the page options api neither the new brand event pages. What I explain covers most basic chrome applications and should be enough to get you started.

Table of Contents

  1. Understand the Chrome Architecture
  2. Understand the Tabs-Extension Relationship
  3. Picking the right interface for the job
@alecxe
alecxe / runner.py
Last active August 23, 2023 14:19
Self-contained minimum example script to run scrapy
import json
from scrapy.crawler import Crawler
from scrapy.contrib.loader import ItemLoader
from scrapy.contrib.loader.processor import Join, MapCompose, TakeFirst
from scrapy import log, signals, Spider, Item, Field
from scrapy.settings import Settings
from twisted.internet import reactor
@lenadroid
lenadroid / Borshtch
Last active December 3, 2018 09:33
How to cook Borshtch
Ingredients:
2 stewpans - one is main = 5 litres, second is for beet
potatoes - 12 items of average size, neither big nor small
beet - 4 items of average size
meat - a piece of pork without fat, size about 10x17x7 santimeters
@hreeder
hreeder / parser.py
Last active February 27, 2024 03:53
Python nginx Log Parser
#!/usr/bin/env python
import gzip
import os
import sys
import re
INPUT_DIR = "nginx-logs"
lineformat = re.compile(r"""(?P<ipaddress>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) - - \[(?P<dateandtime>\d{2}\/[a-z]{3}\/\d{4}:\d{2}:\d{2}:\d{2} (\+|\-)\d{4})\] ((\"(GET|POST) )(?P<url>.+)(http\/1\.1")) (?P<statuscode>\d{3}) (?P<bytessent>\d+) (["](?P<refferer>(\-)|(.+))["]) (["](?P<useragent>.+)["])""", re.IGNORECASE)
@Vestride
Vestride / encoding-video.md
Last active June 5, 2024 14:38
Encoding video for the web

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
@Isk1n
Isk1n / index.html
Last active May 2, 2020 12:03
Plain text linkifiers comparison (work in progress) (http://jsbench.github.io/#54315d74264c857856c73f18c81278dc) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Plain text linkifiers comparison (work in progress)</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
# Demonstrate data download from Emfit API
# Config
remember_token="XXXXXXXX" # token returned from API login
device_id=666 # Your own device id number
from_date = "2017-01-01"
to_date = "2017-01-14"
# End of config
@harperreed
harperreed / emfitqs-local-api.md
Created February 17, 2018 20:08
EMFIT QS Sleep tracker location API

EMFIT Local API

There is a functional http server running on the device that can be crawled for realtime data. It runs on port 80 and uses plain http.

You will need to know the IP address if your emfit device.

shortdvm.htm

For demoing / testing with a web browser there is an auto-refreshing page that contains only HR and RR values, it’s name is shortdvm.htm

@luqmaan
luqmaan / generate-systemd-schedule.js
Last active May 26, 2020 08:10
Script from my blog post "Using systemd as a better cron." https://medium.com/horrible-hacks/using-systemd-as-a-better-cron-a4023eea996d. ⚠️ It may not actually work. 🤷‍♂️
const fs = require("fs");
const getTimerTemplate = (platform, importType, interval) => `
[Unit]
Description=Run ${platform}-${importType} every 15 minutes
Requires=${platform}-${importType}.service
[Timer]
Unit=${platform}-${importType}.service
OnUnitInactiveSec=${interval}