Skip to content

Instantly share code, notes, and snippets.

View copyninja's full-sized avatar

Vasudev Kamath copyninja

View GitHub Profile
#!/usr/local/bin/python3
import re
from urllib.request import urlopen, Request
from urllib.error import HTTPError
def get_page(urlstring):
"""
Arguments:
@copyninja
copyninja / power.sh
Created January 11, 2012 07:04 — forked from chrisyco/power.sh
Suspend, hibernate, restart or shutdown the computer without sudo!
#!/bin/sh
# Suspend, hibernate, restart or shutdown the computer without sudo!
# by Chris Wong
# Released to the public domain.
NAME=$0
usage() {
echo "Usage: $NAME suspend|hibernate|restart|shutdown"
/* Exercise: Loops and Functions #43 */
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
z := float64(2.)
#ifndef __POINTER_H__
#define __POINTER_H__
typedef struct {
int a;
int b;
float c;
} SampleStruct;
#include <string.h>
#include "pointer.h"
void GetSampleStruct(SampleStruct *t){
SampleStruct temp = {1,2,3.0};
memcpy(t, &temp, sizeof(SampleStruct));
return;
}
@copyninja
copyninja / playground.rs
Last active March 19, 2018 06:50 — forked from rust-play/playground.rs
Experiment for converting from String to HashSet and perform operations (Mainly for Column Transformation cipher)
use std::collections::HashSet;
use std::str::FromStr;
fn main() {
let alphabets = String::from_str("ABCDEFGHIJKLMNOPQRSTUVWXYZ").unwrap();
let alpha_set: HashSet<_> = alphabets.split("").filter(|x| x.len() != 0).collect();
let keyword = String::from_str("SECRET").unwrap();
let keyword_set: HashSet<_> = keyword.split("").filter(|x| x.len() != 0).collect();