Skip to content

Instantly share code, notes, and snippets.

SCN-App-Distify

A perl distribution builder for ServerCentral perl projects.

To build a module named SCN-Module-Foo ...

cd SCN-Module-Foo
distify SCN-Module-Foo
@geeknik
geeknik / burpfox.sh
Last active March 1, 2024 22:02
launch firefox with a temporary profile and remove the temporary profile when firefox exits
#!/bin/sh
trap 'rm -rf "$PROFILEDIR"' EXIT
PROFILEDIR=$(mktemp -p /tmp -d tmp-fx-profile.XXXXXX.d)
/path/to/firefox -profile "$PROFILEDIR" -no-remote -new-instance
@dardo82
dardo82 / cam-light-action.sh
Last active September 14, 2018 23:34
FW webcam USB light
#!/bin/zsh
# Use an USB light to let FW webcam see
PATH=$PATH:/usr/local/bin
UHCOPTS=$(uhubctl | awk '{ text=text"\n"$0; if ($0~/hub/) text=$0; if (text~/power$/) { print text; text="" } }' \
| awk -F',| |:' -v ORS=" " '{ print $5 }' | awk '{ print "-p "$2" -l "$1 }')
if [ -n "$UHCOPTS" ]; then
uhubctl -a 0 ${=UHCOPTS}
DEVNAME="iSight"; DEVGUID=$(system_profiler SPCameraDataType | awk -v dev="$DEVNAME:" -F':|x|-' '{ if ($0~dev) n=NR; if (NR==n+3 && NR!=3) print $3 }')
#!/bin/bash
additional_strace_args="$1"
MASTER_PID=$(ps auwx | grep php-fpm | grep -v grep | grep 'master process' | cut -d ' ' -f 6)
while read -r pid;
do
if [[ $pid != $MASTER_PID ]]; then
nohup strace -r -p "$pid" $additional_strace_args >"$pid.trc" 2>&1 &
@dhh
dhh / Basecamp-DDOS.md
Last active August 30, 2023 09:33
Basecamp is under network attack (DDoS)

Basecamp was under network attack

The attack detailed below has stopped (for the time being) and almost all network access for almost all customers have been restored. We're keeping this post and the timeline intact for posterity. Unless the attack resumes, we'll post a complete postmortem within 48 hours (so before Wednesday, March 26 at 11:00am central time).

Criminals have laid siege to our networks using what's called a distributed denial-of-service attack (DDoS) starting at 8:46 central time, March 24 2014. The goal is to make Basecamp, and the rest of our services, unavailable by flooding the network with bogus requests, so nothing legitimate can come through. This attack was launched together with a blackmail attempt that sought to have us pay to avoid this assault.

Note that this attack targets the network link between our servers and the internet. All the data is safe and sound, but nobody is able to get to it as long as the attack is being successfully executed. This is like a bunch of people

@peczenyj
peczenyj / README
Last active August 29, 2015 13:57
This script creates one fuse filesystem with one file, cat.jpg, with a random kitten image (from thecatapi.com)
NEW! you can install via cpan: https://metacpan.org/release/PACMAN/Acme-CatFS-0.001
1. you should install LWP::Simple and Fuse:Simple - use cpan or cpanm
2. you should configure the local fuse install to run as root or as common user
3. don't forget 'fusermount -u <mountpoint>' after finish the script
to install dependencies
you can use regular cpan OR cpanminus ( http://search.cpan.org/~miyagawa/App-cpanminus-1.7001/lib/App/cpanminus.pm )
@jrsmith3
jrsmith3 / round_exponential.py
Created May 6, 2013 22:06
Round a value to an integer [1-9] times a power of 10. How would you write a test for this method?
import numpy as np
def round_exponential(val):
"""
Round a value to an integer [1-9] times a power of 10.
Example
>>> val1 = 7.83126342297e-07
>>> print round_exponential(val1)
>>> 8e-07
@creaktive
creaktive / mojo-crawler.pl
Last active November 28, 2020 13:15
Simple web crawler/scraper implemented using Mojolicious
#!/usr/bin/env perl
use 5.010;
use open qw(:locale);
use strict;
use utf8;
use warnings qw(all);
use Mojo::UserAgent;
# FIFO queue
@dergachev
dergachev / README.md
Last active December 17, 2023 22:07 — forked from anonymous/bookmarklet.js
rule-of-thirds bookmarklet

rule-of-thirds bookmarklet that overlays a rule-of-thirds style grid over all images on a page.

To get the bookmarklet, visit http://bl.ocks.org/4331769

Bookmarklet Development Notes

Do the following to be able to use the "RuleOfThirds-localhost" development version of the bookmarklet:

@dpetrov
dpetrov / cpan_favorites.pl
Created November 7, 2012 08:24
Install all favorited distributions
#!/usr/bin/env perl
use strict;
use warnings;
use 5.010;
use Mojo::UserAgent;
my $url = shift @ARGV or die "Usage: $0 metacpan_author_url";
my $ua = Mojo::UserAgent->new;
my $dom = $ua->get($url)->res->dom;