Skip to content

Instantly share code, notes, and snippets.

View subins2000's full-sized avatar
♥️
ആരാണു് സമാധാനം ആഗ്രഹിക്കാത്തതു്. Queen - 39

Subin Siby subins2000

♥️
ആരാണു് സമാധാനം ആഗ്രഹിക്കാത്തതു്. Queen - 39
View GitHub Profile
@nanmu42
nanmu42 / openinbrowser.go
Created May 20, 2019 09:43
Golang: Open URL in Browser
func openBrowser(url string) {
var err error
switch runtime.GOOS {
case "linux":
err = exec.Command("xdg-open", url).Start()
case "windows":
err = exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start()
case "darwin":
err = exec.Command("open", url).Start()
@benkulbertis
benkulbertis / cloudflare-update-record.sh
Last active April 28, 2024 16:35
Cloudflare API v4 Dynamic DNS Update in Bash
#!/bin/bash
# CHANGE THESE
auth_email="user@example.com"
auth_key="c2547eb745079dac9320b638f5e225cf483cc5cfdda41" # found in cloudflare account settings
zone_name="example.com"
record_name="www.example.com"
# MAYBE CHANGE THESE
ip=$(curl -s http://ipv4.icanhazip.com)
@fzerorubigd
fzerorubigd / dl.php
Created October 16, 2012 12:50
A simple download script with resume and multi-part support
<?php
date_default_timezone_set('GMT');
//1- file we want to serve :
$data_file = "/home/f0rud/Aalto Talk with Linus Torvalds [Full-length].mp4";
$data_size = filesize($data_file); //Size is not zero base
$mime = 'application/otect-stream'; //Mime type of file. to begin download its better to use this.
$filename = basename($data_file); //Name of file, no path included
@dideler
dideler / pyargs.md
Last active January 23, 2023 16:39
Parsing Command-Line Argument in Python

Command-line arguments in Python show up in sys.argv as a list of strings (so you'll need to import the sys module).

For example, if you want to print all passed command-line arguments:

import sys
print(sys.argv)  # Note the first argument is always the script filename.

Command-line options are sometimes passed by position (e.g. myprogram foo bar) and sometimes by using a "-name value" pair (e.g. myprogram -a foo -b bar).

@giltotherescue
giltotherescue / percent-change.php
Created February 24, 2012 15:19
Calculate Percentage Change
<?
/**
Calculates the percentage change between two numbers.
Useful for showing how much traffic has changed from one time period to the next.
*/
$percentChange = function ($cur, $prev) {