Skip to content

Instantly share code, notes, and snippets.

View pushcx's full-sized avatar

Peter Bhat Harkins pushcx

View GitHub Profile
MariaDB [lobsters]> show full processlist;
+-------+----------+-----------+----------+---------+------+-------------------+---------------------------------------------------------------------+----------+
| Id | User | Host | db | Command | Time | State | Info | Progress |
+-------+----------+-----------+----------+---------+------+-------------------+---------------------------------------------------------------------+----------+
| 64327 | lobsters | localhost | lobsters | Query | 5988 | Copy to tmp table | ALTER TABLE `stories` CHANGE `score` `score` int DEFAULT 1 NOT NULL | 51.579 |
| 64463 | lobsters | localhost | lobsters | Query | 0 | Init | show full processlist | 0.000 |
+-------+----------+-----------+----------+---------+------+-------------------+---------------------------------------------------------------------+----------+
2 rows in
@pushcx
pushcx / arch.txt
Created March 23, 2020 12:07
notes for unbreaking arch
boot from usb
setfont sun12x22
wifi-menu -o
name: 'home'
password
yes, save
netctl start home
ping google.com
androiduipatterns.com
zef.me
blog.envylabs.com
hueniverse.com
blog.jelly.co
blog.coinbase.com
maori.geek.nz
techblog.appnexus.com
mondaynote.com
xato.net
MariaDB [lobsters]> select domain, count(*) as submitted, count(distinct stories.user_id) as submitters, (select count(*) from stories s where s.domain_id = domains.id group by s.user_id order by 1 desc limit 1) as from_one_submitter, (select count(*) from stories s where s.domain_id = domains.id group by s.user_id order by 1 desc limit 1)/count(*)*100 as submited_by_one_percentage from domains join stories on domains.id = stories.domain_id group by domain having count(*) > 5 and (from_one_submitter + 1) * 2 > count(*) order by 5 desc;
+-------------------------------------+-----------+------------+--------------------+----------------------------+
| domain | submitted | submitters | from_one_submitter | submited_by_one_percentage |
+-------------------------------------+-----------+------------+--------------------+----------------------------+
| 0xcc.re | 6 | 1 | 6 | 100.0000 |
| acha.ninja
@pushcx
pushcx / query.txt
Created February 10, 2020 13:47
quick select to find content marketers
select domain, count(*) as submitted, count(distinct stories.user_id) as submitters from domains join stories on domains.id = stories.domain_id group by domain having count(*) > 5 and count(distinct stories.user_id) =1 order by 2 desc limit 30;
+----------------------------+-----------+------------+
| domain | submitted | submitters |
+----------------------------+-----------+------------+
| vuejsdevelopers.com | 52 | 1 |
| driftingruby.com | 48 | 1 |
| pythonspeed.com | 40 | 1 |
| tboox.org | 38 | 1 |
| newrustacean.com | 34 | 1 |
| joezimjs.com | 28 | 1 |
@pushcx
pushcx / .irssi-config.autosave
Created January 21, 2020 02:40
irssi config for too many buffers
keyboard = (
{ key = "meta-p"; id = "change_window"; data = "20"; },
{ key = "meta-a"; id = "change_window"; data = "21"; },
{ key = "meta-s"; id = "change_window"; data = "22"; },
{ key = "meta-d"; id = "change_window"; data = "23"; },
{ key = "meta-f"; id = "change_window"; data = "24"; },
{ key = "meta-g"; id = "change_window"; data = "25"; },
{ key = "meta-h"; id = "change_window"; data = "26"; },
{ key = "meta-j"; id = "change_window"; data = "27"; },
{ key = "meta-k"; id = "change_window"; data = "28"; },
.outer {
display: grid;
gap: 1em;
}
/* may be a bug with width=600px windows here, I'm bad at responsive */
@media (min-width: 600px) {
.outer {
grid-template-cols: 1fr 1fr;
background-color: #eee;
@pushcx
pushcx / log
Last active November 13, 2019 14:57
query explains for perf analysis
context: https://lobste.rs/s/5hshvd/proposal_lobste_rs_performance_analysis#c_bp5fdv
# rails console to collect queries:
irb(main):001:0> u = User.find_by(username: 'pushcx');nil
D, [2019-10-02T14:04:06.531843 #12101] DEBUG -- : (0.6ms) SET NAMES utf8mb4, @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
D, [2019-10-02T14:04:06.546456 #12101] DEBUG -- : User Load (1.0ms) SELECT `users`.* FROM `users` WHERE `users`.`username` = 'pushcx' LIMIT 1
=> nil
irb(main):002:0> Comment.for_user(u).order("id DESC").includes(:user, :hat, :story => :user).joins(:story).where.not(stories: { is_expired: true }).limit(20) .offset((1 - 1) * 20);nil
D, [2019-10-02T14:05:35.270496 #12101] DEBUG -- : Comment Load (4609.9ms) SELECT `comments`.* FROM `comments` INNER JOIN `stories` ON `stories`.`id` = `comments`.`story_id` WHERE `stories`.`is_expired` != TRUE ORDER BY id DESC LIMIT 11 OFFSET 0
D, [2019-10-0
@pushcx
pushcx / merged.tsv
Created September 21, 2019 16:30
all merged stories on lobsters
link title
https://lobste.rs/s/kqnxqr Heartbleed Bug (OpenSSL CVE-2014-0160)
https://lobste.rs/s/hvykz9 LibreSSL Will be Portable
https://lobste.rs/s/vraf4g BSDCan 2014: Bob Beck on LibreSSL: the first 30 days, and where we go from here
https://lobste.rs/s/0leenb First release of LibreSSL portable is available
https://lobste.rs/s/bmiu9s Crossing Streams: a Love Letter to io.Reader
https://lobste.rs/s/fi1h79 Watch That Windows Update: FTDI Drivers Are Killing Fake Chips
https://lobste.rs/s/pl0wwu Microsoft Open Sources .NET and Mono
https://lobste.rs/s/kz4gaj Habitat – Home Automation for Products You Already Own (my First KS)
https://lobste.rs/s/acvc2l Violating randomization standards