Skip to content

Instantly share code, notes, and snippets.

View dvliman's full-sized avatar

David Liman dvliman

View GitHub Profile
@dvliman
dvliman / gist:10402435
Created April 10, 2014 17:02
ruby $ global variable
$: (Dollar Colon) is basically a shorthand version of $LOAD_PATH. $: contains an array of paths that your script will search through when using require.
$0 (Dollar Zero) contains the name of the ruby program being run. This is typically the script name.
$* (Dollar Splat) is basically shorthand for ARGV. $* contains the command line arguments that were passed to the script.
$? (Dollar Question Mark) returns the exit status of the last child process to finish.
$$ (Dollar Dollar) returns the process number of the program currently being ran.
$~ (Dollar Tilde) contains the MatchData from the previous successful pattern match.
$1, $2, $3, $4 etc represent the content of the previous successful pattern match.
$& (Dollar Ampersand) contains the matched string from the previous successful pattern match.
$+ (Dollar Plus) contains the last match from the previous successful pattern match.
$` (Dollar Backtick) contains the string before the actual matched string of the previous successful pattern match.
@dvliman
dvliman / gist:11264471
Created April 24, 2014 18:24
4chan source code leak
<?
if(file_exists('/www/global/lockdown')) {
if($_COOKIE['4chan_auser'] && $_COOKIE['4chan_apass'] && ($_POST['mode']=='usrdel'||$_GET['mode']=='latest')) {
// ok
}
else {
die('Posting temporarily disabled. Come back later!<br/>&mdash;Team 4chan (uptime? what\'s that?)');
}
}
include_once "./yotsuba_config.php";
/* Generated on: Fri Feb 03 2023 01:39:15 GMT+0000 (Coordinated Universal Time) */
/* ==========================================================================
normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css
========================================================================== */
/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;
@dvliman
dvliman / gist:f7ed98edb8b9819277a9
Created January 8, 2015 01:58
coupon-at-checkout
/*
* Coupons at Checkout Browser Extension
* Copyright (c) 2012, 2013 CouponFollow, LLC. All rights reserved.
* Copying this source code in any manner is strictly prohibited.
*/
"use strict";
var storage = chrome.storage.local;
@dvliman
dvliman / gist:10016069
Created April 7, 2014 07:27
join honey chrome extension
chrome.runtime.onStartup.addListener(function () {
chrome.storage.local.set({
log: ""
})
});
chrome.runtime.onInstalled.addListener(function (a) {
var b = {
log: ""
};
b.site_manifest = {
// build.gradle
dependencies {
implementation 'com.github.davidmoten:rxjava2-jdbc:0.2.2'
implementation 'org.postgresql:postgresql:42.2.5'
}
Netty started on port(s): 8080
Started ApplicationKt in 7.113 seconds (JVM running for 9.353)
(defn start-stream []
(record :encoder :connect-to-camera (make-event-details ...))
(manager/register :connect-to-camera
(sh/proc "ffmpeg" "-hide_banner" "-re" "-rtsp_transport" "tcp" "-i"
config/encoder-rtsp-endpoint
"-c:a" "aac" "-ar" "48000" "-b:a" "128k"
"-c:v" "h264" "-profile:v" "high"
"-g" "48" "-keyint_min" "48" "-sc_threshold" "0" "-b:v" "3072k"
"-maxrate" "3500k" "-vcodec" "libx264" "-bufsize" "3072k"
"-hls_time" "6"
;; encoder.clj
(defstate encoder
:start (try
(start-stream)
(catch Exception e))
;; error-handling here
:stop (stop-stream))
;; core.clj
(defn run-encoder []
(mount/start #'state/s3
#'state/db
#'encoder/encoder))
(defn -main [& args]
(run-encoder))