Skip to content

Instantly share code, notes, and snippets.

@hraharahra
hraharahra / chapters_to_playlist.py
Created August 17, 2024 21:54 — forked from telugu-boy/chapters_to_playlist.py
takes youtube video with chapters and downloads and splits into playlist based on the chapter timestamps
# https://www.github.com/telugu-boy/
import youtube_dl
import getopt
import sys
import os
# https://www.youtube.com/watch?v=obLq6k3clHo
ydl_opts = {
@hraharahra
hraharahra / Dockerfile
Created June 23, 2023 11:17 — forked from pablomdo/Dockerfile
Docker Squid proxy server example
# Use the official Ubuntu 20.04 image as the base
FROM ubuntu:20.04
# Set environment variables to avoid interactive installation
ENV DEBIAN_FRONTEND=noninteractive
# Update package list and install Squid
RUN apt-get update && \
apt-get install -y squid
#!/bin/sh
# try to create the lock and check the outcome
LOCKFILE=/var/run/spacewalk_datafsck.lock
if [ -e "$LOCKFILE" ]; then
echo "Another instance already running. Aborting."
exit 1
else
touch "$LOCKFILE"
fi
@hraharahra
hraharahra / kerberos_setup.md
Created June 7, 2017 11:53 — forked from ashrithr/kerberos_setup.md
Set up kerberos on Redhat/CentOS 7

Installing Kerberos on Redhat 7

This installation is going to require 2 servers one acts as kerberos KDC server and the other machine is going to be client. Lets assume the FQDN's are (here cw.com is the domain name, make a note of the domain name here):

  • Kerberos KDC Server: kdc.cw.com
  • Kerberos Client: kclient.cw.com

Important: Make sure that both systems have their hostnames properly set and both systems have the hostnames and IP addresses of both systems in

@hraharahra
hraharahra / AssertExtension.cs
Created April 10, 2017 04:30 — forked from gilles-leblanc/AssertExtension.cs
A better alternative than using the ExpectedException attribute for catching exceptions in C#.
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace TestUtilities
{
public static class AssertExtension
{
public static T Throws<T>(Action expressionUnderTest, string exceptionMessage = "Expected exception has not been thrown by target of invocation.") where T : Exception
{
try
@hraharahra
hraharahra / README.md
Created March 30, 2017 11:41 — forked from mcoms/README.md
Eken H9 Action Camera Firmware

Official source for the latest firmware

Eken supply firmware for their H2, H2R, H3, H3R, H8, H8R, H9 and H9R cameras via the following site:

http://ftp.eken.com/

The "R" camera versions come with a remote control.

Selecting the right file

@hraharahra
hraharahra / gist:8f5cb4b9fe02f174535b872419c0b871
Created March 15, 2017 13:50 — forked from leggetter/gist:769688
How to get the body of a HTTP Request using C#
private string GetDocumentContents(System.Web.HttpRequestBase Request)
{
string documentContents;
using (Stream receiveStream = Request.InputStream)
{
using (StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8))
{
documentContents = readStream.ReadToEnd();
}
}
@hraharahra
hraharahra / gist:55256a44c46afff487c0ace7f38ace12
Created January 10, 2017 10:46 — forked from weavenet/gist:1524036
Disable DNS lookup when starting WEBrick
#!/bin/bash
if [ `whoami` != "root" ]; then
echo "$0 must be run as root."
exit 1
fi
for i in $(locate webrick/config.rb); do
echo "Processing $i"
sed -e 's/^.*:DoNotReverseLookup => nil,$/:DoNotReverseLookup => true,/' $i > /tmp/config.rb
@hraharahra
hraharahra / gist:94b5d0fc9cd9dd05c3dd7eff0807ec92
Created September 17, 2016 13:46 — forked from lanimall/gist:cb808a11a058f7fb620a
SSL Protocol Tests - TLSv1.2
public class SSLProtocolTests {
public static void main(String[] args) throws Exception {
SSLContext context = SSLContext.getInstance("TLSv1.2");
context.init(null,null,null);
SSLSocketFactory factory = (SSLSocketFactory)context.getSocketFactory();
SSLSocket socket = (SSLSocket)factory.createSocket();
String[] protocols = socket.getSupportedProtocols();
@hraharahra
hraharahra / gist:78696792a7c799d93578f710423e3001
Created September 17, 2016 13:46 — forked from lanimall/gist:cb7d84c8d6c6301d4d0c
SSL Protocol Tests - Default
public class SSLProtocolTests {
public static void main(String[] args) throws Exception {
SSLContext context = SSLContext.getDefault();
SSLSocketFactory factory = (SSLSocketFactory)context.getSocketFactory();
SSLSocket socket = (SSLSocket)factory.createSocket();
String[] protocols = socket.getSupportedProtocols();
System.out.println("Supported Protocols: " + protocols.length);
for(int i = 0; i < protocols.length; i++)