This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <memory> | |
#include <boost/asio.hpp> | |
#include <boost/bind.hpp> | |
//thanks kalven for tips/debugging | |
using boost::asio::ip::tcp; | |
class Session : public std::enable_shared_from_this<Session> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To list all torrents in view 'main' and its tracker url we can chain commands like so: | |
# for testing | |
$ python3 -m rtorrent_xmlrpc scgi://localhost:16891/RPC2 | |
d.multicall2 '' main d.name= d.size_bytes= d.creation_date= t.multicall=,t.url= f.multicall=,f.path= | |
d.multicall2 '' main d.name= d.size_bytes= d.creation_date= d.directory_base= t.multicall=,t.url= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/sh | |
/opt/bin/nvidia-settings -a [gpu:0]/GPUFanControlState=1 | |
/opt/bin/nvidia-settings -a [gpu:1]/GPUFanControlState=1 | |
/opt/bin/nvidia-settings -a [gpu:2]/GPUFanControlState=1 | |
/opt/bin/nvidia-settings -a [gpu:3]/GPUFanControlState=1 | |
/opt/bin/nvidia-settings -a [fan:0]/GPUTargetFanSpeed=100 | |
/opt/bin/nvidia-settings -a [fan:1]/GPUTargetFanSpeed=100 | |
/opt/bin/nvidia-settings -a [fan:2]/GPUTargetFanSpeed=100 | |
/opt/bin/nvidia-settings -a [fan:3]/GPUTargetFanSpeed=100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# FFmpeg configure script | |
# | |
# Copyright (c) 2000-2002 Fabrice Bellard | |
# Copyright (c) 2005-2008 Diego Biurrun | |
# Copyright (c) 2005-2008 Mans Rullgard | |
# | |
# Prevent locale nonsense from breaking basic text processing. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew update | |
brew install php | |
git clone --depth 1 https://github.com/phacility/libphutil.git | |
git clone --depth 1 https://github.com/phacility/arcanist.git | |
if grep -Fxq 'export PATH=$PATH:$HOME/repos/arcanist/bin' ~/.zshrc | |
then | |
echo 'export PATH=$PATH:$HOME/repos/arcanist/bin' | tee -a ~/.zshrc | |
else | |
echo 'arcanist bin path exists in path, not appending' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (c) 1999-2001,2005-2012 Apple Inc. All Rights Reserved. | |
* | |
* @APPLE_LICENSE_HEADER_START@ | |
* | |
* This file contains Original Code and/or Modifications of Original Code | |
* as defined in and that are subject to the Apple Public Source License | |
* Version 2.0 (the 'License'). You may not use this file except in | |
* compliance with the License. Please obtain a copy of the License at | |
* http://www.opensource.apple.com/apsl/ and read it before using this |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION update_table (target_table text, timestamp_col text, | |
from_timestamp timestamp with time zone, constraint_name text, t ANYELEMENT) | |
RETURNS SETOF ANYELEMENT | |
AS $$ | |
DECLARE | |
querytext text; | |
DECLARE | |
tmp text; | |
BEGIN | |
SELECT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create or replace function singapore_postcode_to_district (code text, out district_num int, out district_name text) | |
as $$ | |
begin | |
case substring(code from 1 for 2)::int | |
when 01, 02, 03, 04, 05, 06 then | |
district_num := 1; | |
district_name := 'Raffles Place, Cecil, Marina, People''s Park'; | |
when 07, 08 then | |
district_num := 2; | |
district_name := 'Anson, Tanjong Pagar'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PUT _ingest/pipeline/extract_timestamp_fromlogfile | |
{ | |
"processors": [ | |
{ | |
"grok": { | |
"field": "message", | |
"patterns": ["%{TIMESTAMP_ISO8601:timestamp}"] | |
} | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function right() { | |
screencapture -R706,427,1,1 -t bmp /tmp/pixel.bmp | |
echo `xxd -p -l 3 -s 54 /tmp/pixel.bmp` | |
rm /tmp/pixel.bmp | |
} | |
function left() { | |
screencapture -R593,424,1,1 -t bmp /tmp/pixel.bmp | |
echo `xxd -p -l 3 -s 54 /tmp/pixel.bmp` | |
rm /tmp/pixel.bmp |
NewerOlder