This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python3 | |
import re | |
from urllib.request import urlopen, Request | |
from urllib.error import HTTPError | |
def get_page(urlstring): | |
""" | |
Arguments: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Exercise: Loops and Functions #43 */ | |
package main | |
import ( | |
"fmt" | |
"math" | |
) | |
func Sqrt(x float64) float64 { | |
z := float64(2.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef __POINTER_H__ | |
#define __POINTER_H__ | |
typedef struct { | |
int a; | |
int b; | |
float c; | |
} SampleStruct; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string.h> | |
#include "pointer.h" | |
void GetSampleStruct(SampleStruct *t){ | |
SampleStruct temp = {1,2,3.0}; | |
memcpy(t, &temp, sizeof(SampleStruct)); | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |