Skip to content

Instantly share code, notes, and snippets.

View xnuk's full-sized avatar
🏳️‍🌈
pride

즈눅 xnuk

🏳️‍🌈
pride
View GitHub Profile
@queertypes
queertypes / Client.hs
Created March 20, 2015 15:28
Echo Client
{-# LANGUAGE OverloadedStrings #-}
module Client where
import Network.Socket hiding (recv)
import Network.Socket.ByteString
run :: IO ()
run = do
addrInfo <- getAddrInfo Nothing (Just "localhost") (Just "3000")
let addr = head addrInfo
@dittos
dittos / aheui.hs
Last active December 27, 2015 02:09
aheui.hs (r2: refactoring WIP)
import System.Exit
{-
Data Structures
-}
data Dir = SetDir Int Int | FlipX | FlipY | FlipXY | KeepDir
data Op = DivOp | AddOp | MulOp | ModOp | DupOp | SwitchOp Int | MoveOp Int
| CmpOp | BranchOp | SubOp | SwapOp | ExitOp | PrintNumOp
/*
code
{
char: string,
cho: number,
jung: number,
jong: number,
eliminate: boolean
}
*/
{
"rate_limit_context": {
"access_token": "*"
},
"resources": {
"profile_spotlight": {
"/profile_spotlight/show": {
"limit": 180,
"remaining": 180,
"reset": 1467248717
@unstabler
unstabler / encode-all.sh
Last active March 24, 2017 09:25
ffserver streaming
#!/bin/sh
for file in *.avi
do
file_without_ext=$(echo "$file" | sed -e 's/\.avi//')
subtitle="$file_without_ext.smi"
outfile="$file_without_ext.ts"
if ! [ -f "$subtitle" ]
then
echo "자막 파일 $subtitle 이 존재하지 않습니다! 다음으로 넘어갑니다.." | tee -a encode.log
continue
@EvanOxfeld
EvanOxfeld / until-stream.md
Last active October 13, 2017 17:42
A node.js stream that stops piping when a pattern is reached

The new nodejs Streams2 API is great at buffering, handles back-pressure for you in many cases, and exposes a nice read() method that allows reading a fixed length number of bytes. However, if you'd like to read from a stream or pipe a stream into a destination stream until a pattern, you're back to some level of rolling your own buffering and back-pressure support. UntilStream aims to solve both use cases.

Examples below, more details can be found on EvanOxfeld/until-stream.

Quick Examples

Pipe to a destination stream until the pattern is reached

UntilStream unpipes and ends the destination stream when the pattern is reached. The next call to read() returns exactly the pattern. Back-pressure is handled for you.

@chalkpe
chalkpe / kt-egg.md
Last active February 4, 2019 18:01

KT 에그 간단 설명

모든 요청 기본값

  • POST http://192.168.1.1/cgi-bin/webmain.cgi
  • Content-Type: multipart/form-data

로그인 세션 얻기

요청

이름
@rauschma
rauschma / proxies-es5.js
Last active November 2, 2020 23:16
ES6 proxies in ES5
//----- The ECMAScript 6 meta object protocol (MOP) implemented in ES5
// This is how getting a property is handled internally.
// Double underscore (__) implies internal operation.
Object.prototype.__Get__ = function (propKey, receiver) {
receiver = receiver || this;
var desc = this.__GetOwnProperty__(propKey);
if (desc === undefined) {
var parent = this.__GetPrototypeOf__();
if (parent === null) return undefined;
@chrisjacob
chrisjacob / README.md
Created July 16, 2011 11:23
How to: GitHub Pages "gh-pages" branch for User & Organization Pages

GitHub Pages "Normal" Setup for User & Organization Pages

Let’s say your GitHub username is “alice”. If you create a GitHub repository named alice.github.com, commit a file named index.html into the master branch, and push it to GitHub, then this file will be automatically published to http://alice.github.com/... The same works for organizations.

Read more here: http://pages.github.com/

However... the downside of this is that anyone that forks this repo won't get it as a GitHub Pages repo when they are working on it... because they have a different GitHub "username" (or "organisation name").

So the trick is to not use a master branch as the documentation tells you... rather, use a gh-pages branch, as you would for your other "Project Pages".

@pbzweihander
pbzweihander / enable_phonesim.sh
Created August 19, 2020 06:32
Enable phonesim to use bluetooth headset's mic (e.g. AirPods Pro)
#!/usr/bin/env bash
# Use i3-msg or something that can spawn to background
i3-msg exec "phonesim -p 12345 /usr/share/phonesim/default.xml"
sudo systemctl start ofono.service
dbus-send --print-reply --system --dest=org.ofono /phonesim org.ofono.Modem.SetProperty string:"Powered" variant:boolean:true
dbus-send --print-reply --system --dest=org.ofono /phonesim org.ofono.Modem.SetProperty string:"Online" variant:boolean:true