Skip to content

Instantly share code, notes, and snippets.

View alimbada's full-sized avatar

Ammaar Limbada alimbada

View GitHub Profile
@sukesh-ak
sukesh-ak / README.md
Last active October 26, 2023 10:15
How to Convert OVA to VHDX

How to convert OVA to VHDX

  • Rename .OVA file to .7z
  • Use winrar to extract .vmdk out of it

Read here and install qemu (extract zip file)

https://cloudbase.it/qemu-img-windows/

qemu-img convert "D:\VirtualBox\Open-disk001.vmdk" -O vhdx -o subformat=dynamic "D:\VirtualBox\Open.vhdx"

@czaux
czaux / DNSExternalResolver.py
Last active June 7, 2021 14:05
Get External IP with whoami.cloudflare and DNSPython
import dns.resolver #dnspython
my_resolver = dns.resolver.Resolver()
#Cloudflares DNS Server
my_resolver.nameservers = ['1.1.1.1']
#Get IP from cloudflare chaosnet TXT record
#https://community.cloudflare.com/t/can-1-1-1-1-be-used-to-find-out-ones-public-ip-address/14971/6
result = my_resolver.resolve("whoami.cloudflare","TXT", "CH", tcp=True, lifetime=15)
response = result.response
answer = response.answer
ExternalIP = str(list(answer[0])[0]).replace('"', '')
@yzgyyang
yzgyyang / FreeBSD_mount_img_files.md
Created June 28, 2017 20:46
FreeBSD mount img files

Determine the file system by using the file-utility.

file image.img

Use mdconfig to link the IMG image to a virtual device.

mdconfig -a -t vnode -f /path/to/image.img -u 0
@braian87b
braian87b / relayd-igmpproxy.sh
Last active October 22, 2023 12:32
How to setup Client Bridged / Client Mode / RelayD and IGMPProxy for OpenWRT / LEDE
# Client Bridged / Client Mode / RelayD and IGMPProxy (It works)
# RelayD is to redirect packages and IGMP is for redirect IGMP packages
# Our network is 192.168.1.0/24
# Steps:
# Configure WAN as static
# We should edit our wan iface and put static IP
uci set network.wan='interface'
uci set network.wan.proto='static'
uci set network.wan.ipaddr='192.168.1.239' # Main Network IP
@dvdsgl
dvdsgl / Monads for a C# dev.md
Last active January 8, 2024 06:11
Monads explained (sort of) to a C# developer

A monad is a fancy word for a generic type of the form MyMonad<T> (a generic type of arity 1).

A monad is special because it adds 'special powers' to the T that it wraps. These 'special powers' won't sound very special to an imperative programmer, so you have to squint to see them but bear with me.

  • IEnumerable<T> is a monad that gives values of type T the special power of nondeterminism, or the ability to 'be' multiple values at once.
  • Nullable<T> is a monad that gives values of type T the special power of nullability, or the ability to be absent.
  • Task<T> is a monad that gives values of type T the special power of asynchronicity, or the ability to be used before they are computed.

The trick with monads comes when you want to play with the T values, because they are inside another type. C# introduced language changes to make dealing with values inside these monads easier:

@mikeminutillo
mikeminutillo / ProjectDependencies.cs
Created June 12, 2015 01:25
Get project dependency graph out using yuml.me and LINQPad
void Main()
{
var ignores = new Regex[]
{
new Regex(@"Approval"),
new Regex(@"Test"),
new Regex(@"Demo")
};
var serviceControl = @"C:\Code\Particular\ServiceControl\src\";
Util.Image("http://yuml.me/diagram/scruffy;scale:150/class/" + String.Join(",", GetDependencies(serviceControl, ignores))).Dump();
curl -u admin -k -d command=poweroff -d shutdown_option=1 -d OPERATION=set -d PAGE=System -d OUTER_TAB=tab_shutdown -d INNER_TAB=none https://{$1}/get_handler|awk -F"message>" '{print $2}'|awk -F"</" '{print $1}'
or
curl -u admin:netgear1 -k -d command=poweroff -d shutdown_option=1 -d OPERATION=set -d PAGE=System -d OUTER_TAB=tab_shutdown -d INNER_TAB=none https://10.20.0.102/get_handler
or
curl -u $user:$pass -k "https://$host/admin/index.cgi?CURRENTTAB=Shutdown&CURRENTPAGE=System&MODE=Advanced&button=Current&command=poweroff&MODIFIED=1" >/dev/null 2>/dev/null
@mariusGundersen
mariusGundersen / gist:6925246
Last active May 8, 2022 20:38
Programmer collective nouns
@mmdemirbas
mmdemirbas / LogFile.udl.xml
Created September 13, 2012 11:34
Custom log file syntax highlighting for Notepad++
<NotepadPlus>
<UserLang name="LogFile" ext="log">
<Settings>
<Global caseIgnored="yes" />
<TreatAsSymbol comment="no" commentLine="no" />
<Prefix words1="no" words2="no" words3="no" words4="no" />
</Settings>
<KeywordLists>
<Keywords name="Delimiters">[(0])0</Keywords>
<Keywords name="Folder+"></Keywords>