Skip to content

Instantly share code, notes, and snippets.

View xnuk's full-sized avatar
๐Ÿณ๏ธโ€๐ŸŒˆ
pride

์ฆˆ๋ˆ… xnuk

๐Ÿณ๏ธโ€๐ŸŒˆ
pride
View GitHub Profile
{-# LANGUAGE PackageImports, OverloadedStrings, LambdaCase #-}
module Http2MastodonStream where
import "http2-client" Network.HTTP2.Client
import "data-default-class" Data.Default.Class
import "tls" Network.TLS
import "tls" Network.TLS.Extra.Cipher
import "http2" Network.HTTP2
import "bytestring" Data.ByteString.Char8 (pack)
import qualified "bytestring" Data.ByteString.Char8 as B
@xnuk
xnuk / pack.rb
Created May 19, 2018 09:26
Automatically add deps if you watch well. I know it's dirty
#!/usr/bin/env ruby
a = File.read("./package.yaml")
by_library = a.split(/(\nlibrary: *\n)/, 2)
by_dependencies = by_library[2].split(/((?:^|\n) +dependencies: *\n)/, 2)
dir = by_library[2].split(/((?:^|\n) +source-dirs: +)/, 2)[2].split("\n", 2)[0].strip
by_dependencies[2] = by_dependencies[2].sub (/^(?:\n?( +)- [^\n]+\n)+/) do |m|
`rg '^import(?: qualified)? "([^"]+)"' --replace='#{$1}- $1' --only-matching --type=haskell --no-filename --no-config --no-line-number --color=never #{dir} | sort -u`
@xnuk
xnuk / my-k.js
Created February 19, 2018 13:17
https://myk.kbs.co.kr/ ๋“ค์–ด๊ฐ€์„œ ์ฝ˜์†”์ฐฝ ์—ด๊ณ  ์‹คํ–‰์‹œํ‚ค๊ณ  TV ์˜จ์—์–ด ๋ฉ”๋‰ด์—์„œ ๋ณด์‹ค ๋ฐฉ์†ก ์„ ํƒํ•˜์‹œ๋ฉด rtmp ๋ฏธ๋””์–ด ์ฃผ์†Œ๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค ๊ทธ๊ฑธ ๋™์˜์ƒ ํ”Œ๋ ˆ์ด์–ด์—์„œ ์—ฌ์„ธ์š”
const pk_token = document.getElementsByName('pk_token')[0].value
var dafuq = {}
fetch('https://myk.kbs.co.kr/broadcast_live/channel_master_items_json', {
method: 'POST',
body: new URLSearchParams('src_channel_type=&os_type=pc&pk_token=' + pk_token),
credentials: 'same-origin', // for use cookie
keepalive: true
}).then(v => v.json()).then(channels =>
@xnuk
xnuk / hpack-setup.rb
Last active December 13, 2017 14:00
๋Œ€์ถฉ ์˜ˆ์˜๊ฐœ ์ง  ๊ฑฐ ๊ฐ™์•„์„œ ๊ณต์œ ํ•ด๋ด„
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'yaml'
require 'net/http'
require 'uri'
require 'find'
require 'set'
require 'optparse'
require 'date'
const {parse: crawl, SELECTOR, CONVERT, DATA} = require("crawl-it")
const {get} = require("request")
const {parse: json5} = require('json5')
get("http://m.airkorea.or.kr/sub_new/sub11.jsp", (e, r, b) => {
console.log(crawl(b, {
[DATA]: 'script/text()',
[CONVERT]: v => json5('{' +
v.split('var wrapper;')[0].trim()
.replace(/var\s+JSONObject([^=]+)=/g,'$1:')
// require https://raw.githubusercontent.com/mozilla/readability/master/Readability.js
function uri(x) {
const a = document.createElement('a')
a.href = x
const {href, hostname, pathname, protocol} = a
return {
spec: href, host: hostname,
prePath: protocol + '//' + hostname,
scheme: protocol.substr(0, protocol.indexOf(':')),
@xnuk
xnuk / stack-clean-snapshot.pl
Last active August 5, 2017 22:36
~/.stack/ ์‚ฌ์ด์ฆˆ ์ค„์ด๊ธฐ ์Šคํฌ๋ฆฝํŠธ
#!/usr/bin/perl
use v5.24.0;
use strict;
use warnings;
use autodie;
no warnings 'experimental';
use constant DIR => "$ENV{'HOME'}/.stack/";
my $prevdir = `pwd`;
Case [0,0,0,0]: N/A
Case [0,0,0,1]: N/A
Case [0,0,0,2]: N/A
Case [0,0,0,3]: N/A
Case [0,0,0,4]: N/A
Case [0,0,0,5]: N/A
Case [0,0,0,6]: N/A
Case [0,0,0,7]: N/A
Case [0,0,0,8]: N/A
Case [0,0,0,9]: (0+((0^0)+9))=10.0
@xnuk
xnuk / twitter_profile_clickable.css
Created June 17, 2017 00:10
ํŠธ์œ„ํ„ฐ ํ”„๋กœํ•„ ํด๋ฆญ ์›๋ž˜๋Œ€๋กœ ํ•˜๊ธฐ
ul[aria-hidden="false"][aria-labelledby="user-dropdown-toggle"]>li.current-user>a:before {
content: '';
display: block;
height: 60px;
margin-top: -60px;
}
@xnuk
xnuk / like.svg
Created June 15, 2017 15:26
๋ฐ”๋€Œ๊ธฐ ์ „์˜ ํŠธ์œ„ํ„ฐ ์•„์ด์ฝ˜
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.