Skip to content

Instantly share code, notes, and snippets.

@dhoss
dhoss / result.txt
Created December 1, 2023 22:10
day 1 part 2 result
Checking two1nine for number 3
Checking two1nine for number 2
2 is the last number
Checking eightwothree for number 8
8 is the first number
Checking eightwothree for number 5
Checking eightwothree for number 4
Checking eightwothree for number 9
Checking eightwothree for number 1
Checking eightwothree for number 7
@dhoss
dhoss / DayOne.java
Created December 1, 2023 22:09
AoC Day 1 Part 2
package in.stonecolddev;
import java.util.List;
import java.util.Map;
public class DayOne implements DayRunner {
public static String partOne(List<String> data) {
Integer sum = 0;
@dhoss
dhoss / tweet_dumper.py
Last active June 13, 2019 00:49 — forked from yanofsky/LICENSE
A script to download all of a user's tweets into a csv
#!/usr/bin/env python
# encoding: utf-8
import tweepy #https://github.com/tweepy/tweepy
import csv
import sys
#Twitter API credentials
consumer_key = ""
consumer_secret = ""
# I've tried both of these:
try:
for part in parts:
dirs = [dir for dir in os.listdir(path_to_check) if not isfile(os.path.join(path_to_check, dir))]
if "thing" in dirs:
return path_to_check
del path_parts[-1]
else:
raise ValueError("thing not found")
@dhoss
dhoss / code-practice.md
Last active November 24, 2017 20:45
code practice
  • take a string, tokenize words, count number of unique words and have a method that can return top N distinct words: https://github.com/dhoss/gotoke
  • analyze csv log file of http requests. format will be request type,url,request status code, response size. group by url + request type, and aggregate the request size
  • create http crawler that will take number of parallel threads/requests, rate limit, and total number of requests to be executed as parameters and implement rate limiting, parallel requests and exit after maximum number of requests complete.
@dhoss
dhoss / dhoss.md
Created September 7, 2017 21:52 — forked from perigrin/dhoss.md
@dhoss
dhoss / gist:acf0d7e83e0e27e01402f0d6a5f469a9
Created September 23, 2016 18:11
sqlalchemy transaction crap
sqlalchemy.engine.base.Engine: INFO: select version()
sqlalchemy.engine.base.Engine: INFO: {}
sqlalchemy.engine.base.Engine: INFO: select current_schema()
sqlalchemy.engine.base.Engine: INFO: {}
sqlalchemy.engine.base.Engine: INFO: SELECT CAST('test plain returns' AS VARCHAR(60)) AS anon_1
sqlalchemy.engine.base.Engine: INFO: {}
sqlalchemy.engine.base.Engine: INFO: SELECT CAST('test unicode returns' AS VARCHAR(60)) AS anon_1
sqlalchemy.engine.base.Engine: INFO: {}
sqlalchemy.engine.base.Engine: INFO: show standard_conforming_strings
sqlalchemy.engine.base.Engine: INFO: {}
@dhoss
dhoss / BaseService.java
Created May 26, 2016 19:56
base service
import org.jooq.Record;
import org.jooq.RecordMapper;
import com.lumos.db.tables.pojos.Images;
import org.jooq.Table;
import java.util.List;
import static com.lumos.db.Tables.IMAGES;
/**
@dhoss
dhoss / BaseService.java
Created May 26, 2016 18:09
recordmapper issues
package com.lumos.service;
import com.lumos.ConfigReader;
import com.lumos.util.Data;
import com.lumos.util.Page;
import org.jooq.DSLContext;
import org.jooq.Record;
import org.jooq.RecordMapper;
import com.lumos.db.tables.pojos.Images;
import org.jooq.Table;
@dhoss
dhoss / BaseService.java
Created May 25, 2016 18:17
jooq base dao class issues
package com.lumos.service;
import com.lumos.ConfigReader;
import com.lumos.util.Data;
import com.lumos.util.Page;
import org.jooq.DSLContext;
import org.jooq.Record;
import org.jooq.RecordMapper;
import com.lumos.db.tables.pojos.Images;
import org.jooq.Table;