Skip to content

Instantly share code, notes, and snippets.

@yevrah
yevrah / api.cs
Created August 17, 2016 03:02
CC: API Connection in CSharp
using System;
using System.IO;
using System.Net;
using System.Text; // for class Encoding
namespace ClassCover.Api.Example
{
public class API
{
@yevrah
yevrah / quicktime_screencast_prep.sh
Created June 9, 2016 01:02
FFMPEG: Reduce QuickTime Screencast Filesize
#!/usr/bin/bash
ffmpeg -i SCRUM-2016-06-08.mov -vf scale=1024x768,setdar=16:9 -c:v libx264 -preset slow -profile:v main -crf 20 output-1024.mp4
@yevrah
yevrah / productionalise.sh
Created April 26, 2016 04:21
Bash: Productionalise
#!/bin/bash
# Take a snopshot of code and sym link it to a published apached location
# Created By: Javier Woodhouse
user=$1
symbolic_path=$2
source=$3
date_part=`date +"%Y%m%d-%I%M%S"`
destination="$user.$date_part"
@yevrah
yevrah / productionalise.sh
Created April 26, 2016 04:21
Bash: Productionalise
#!/bin/bash
# Take a snopshot of code and sym link it to a published apached location
# Created By: Javier Woodhouse
user=$1
symbolic_path=$2
source=$3
date_part=`date +"%Y%m%d-%I%M%S"`
destination="$user.$date_part"
@yevrah
yevrah / apache_mem.sh
Last active November 24, 2015 05:33
Apache: Mem Summary
#!/bin/bash
printf "\nMemory Status\n"
ps aux | grep '^apache' | awk '{print $1, $2, $11, $6/1024 " MB";}'
printf "\nSum: "
ps aux | grep '^apache' | awk '{sum+= $6;} END {print sum/1024 " MB";}'
printf "Average: "
ps aux | grep '^apache' | awk '{print $6/1024;}' | awk '{avg += ($1 - avg) / NR;} END {print avg " MB";}'
@yevrah
yevrah / CoreTest.pl
Created November 15, 2015 23:47
Perl: Ovverride core perl routines
#!/usr/bin/env perl
# See my post on http://stackoverflow.com/questions/33725298/perl-disable-shell-access
# Ref: https://github.com/Perl/perl5/blob/blead/lib/CORE.pod
BEGIN {
*CORE::GLOBAL::system = sub {
die('Do not use system calls.');
};
@yevrah
yevrah / echo.pl
Created July 31, 2015 02:20
Perl: Simple echo server using mojo
#!/usr/bin/env perl
# Usage:
# perl echo.pl daemon
use Mojolicious::Lite;
get '/' => 'index';
websocket '/echo' => sub {
@yevrah
yevrah / remove-pass.vb
Last active June 8, 2021 02:26
Excel: Remove Excel Password
' src: http://www.mcgimpsey.com/excel/removepwords.html
'
' Removing Internal XL passwords
'
' Note: For a discussion of File or VBA Project password protection, see here.
'
' Internal XL passwords are about as useful for security as tissue paper. The
' reason is that the passwords you enter (i.e., with Tools/Protect/Protect
' Worksheet or /Protect Workbook) are not used directly in protection. Instead
' they are hashed (mathematically transformed) into a much less secure code.
@yevrah
yevrah / curl-downloader.pl
Created April 28, 2015 05:19
Perl: Download files using libcurl
#!/usr/bin/perl
use strict;
use warnings;
use WWW::Curl::Easy;
use File::Temp qw/tempfile/;
my ($out, $filename) = tempfile();
my $curl = WWW::Curl::Easy->new();
$curl->setopt(CURLOPT_URL, "https://github.com/libwww-perl/libwww-perl/archive/6.13.zip");
@yevrah
yevrah / log_to_table.sql
Last active September 11, 2018 03:51
MySQL: Log to table
-- Turn on table based logging
set global log_output = 'TABLE';
-- Turn on general log
set global general_log = 'ON';
-- Log everything to slow query log
set global log_slow_queries = 1;
set global long_query_time = 0.000001;