Skip to content

Commit

Permalink
Merge branch 'master' into jspowerset
Browse files Browse the repository at this point in the history
  • Loading branch information
wzhouwzhou authored Oct 3, 2021
2 parents 8fb2ec5 + 849ba41 commit 5507d93
Show file tree
Hide file tree
Showing 48 changed files with 366 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,4 @@ Module.symvers
Mkfile.old
dkms.conf
/.vs
.Rproj.user
47 changes: 47 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,11 @@ Coding Experience: Discord Bot Developer (Java) + misc. wrappers. <br>
Programming Languages: Python 2/3, Java 8<br>
Email: [email protected]

Name: [Shubham Patil](https://github.com/shubhamdpatil)
Place: Pune, India
Coding Experience: C, python
Email: [email protected]

Name: [Lizard Morrow] (https://github.com/onlyasmalllizard) </br>
Place: UK </br>
Coding Experience: Ruby, Python, C, HTML/CSS </br>
Expand Down Expand Up @@ -444,3 +449,45 @@ Name:[Caden Mccauley](https://github.com/DiscoTiger) </br>
Place: United States </br>
Coding Experience: CS Student primarily focusing on Javascript and C++
Email: [email protected] </br>

Name: [Roger Seekell](https://github.com/rpstester) <br />
Place: Earth<br />
Coding Experience: C++, C#, Java, PowerShell<br />
Email: [email protected]<br />

Name: [Abhay yadav](https://github.com/predator21x) </br>
place: India. </br>
Coding Experience: a newbie in this field. Programming language: C, python. </br>
Email: [email protected] </br>

Name: [Abhishek Singh](https://github.com/n6wbi6) </br>
Place: India </br>
Coding Experience: C and python. </br>
Email: [email protected] </br>

Name: [Isak Rabin](https://github.com/sgirabin)
Place: Singapore
Coding Experience: Java
Email: [email protected]

Name: [Zombie Chibi XD](https://github.com/ZombieChibiXD) </br>
Place: Bali, Indonesia </br>
Field Experience: System Administrator, Junior web developer, beta-tester, and debugger </br>
Coding Experience: 3 years of learning & coding experience in C++, Java, Javascript/NodeJS, PHP, Vue.js, Laravel Framework, GoLang and python. </br>
Email: [email protected] </br>

Name: [Oyvind Nilsen](https://github.com/turbosnute) </br>
Place: Trondheim, Norway </br>
Field Experience: System Admin </br>
Coding Experience: 10 years of Powershell scripting. Also some experience with Java, Js, PHP, Python and C#. </br>
Email: [email protected] </br>

Name: [Jay](https://github.com/TacticalTechJay) </br>
Place: Milky Way Galaxy </br>
Coding Experience: Semi-noob in JS. </br>
Email: [email protected] </br>

Name: [David](https://github.com/Xander1233) </br>
Place: Frankfurt, Germany </br>
Coding Experience: TS, JS/NodeJS, Java, C, C++, C#, Assembly, React
Email: [email protected] </br>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Have some fun with coding every once in a while, and see how you can abuse the s
### Contributing
Anyone can contribute to this repo by opening a PR, your contribution will be open-source on Github. Don't know what to make? Try coding something that logs "Hello, world!" to the console!

### Hacktoberfest 2019
### Hacktoberfest 2021
Celebrate [Hacktoberfest](https://hacktoberfest.digitalocean.com/) together with a diverse community of developers from around the world!

### PRs not marked as spam will be counted towards **4** PRs in the month of October for your **free Hacktoberfest T-Shirt!**
Expand Down
1 change: 1 addition & 0 deletions awk/pbootly_temperature_convertor.awk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BEGIN {printf "Enter a temperature of format ##f or ##c to get the opposing value\n"; getline < "-"} BEGIN { if ( $1 ~ /f/ ) { print (((substr($1, 1, length($1)-1) - 32) * 5/9))"C"} else if ( $1 ~ /c/ ) { print (substr($1, 1, length($1)-1) * 9 / 5 + 32"F")} else {print "Usage: ##f to convert to celcius ##c to convert to fahrenheit"}}
9 changes: 9 additions & 0 deletions c/HarshitaArun_Swap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <stdio.h>
void main()
{
int a,b;
printf("enter a and b\n");
scanf("%d%d",&a,&b);
a=(a+b)-(b=a); // one line code
printf("a=%d and b=%d",a,b);
}
18 changes: 18 additions & 0 deletions c/gcd/shubhamdpatil_gcd.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* @file: shubhamdpatil_gcd.c
*/

#include <stdio.h>

int gcd(int x, int y)
{
return (y == 0) ? x : gcd(y, x % y);
}

int main()
{
int a, b;
scanf("%d %d", &a, &b);
printf("GCD of %d and %d: %d\n", a, b, gcd(a, b));
return 0;
}
8 changes: 8 additions & 0 deletions c/hello/n6wbi6_hello_world.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <stdio.h>

int main() {

printf("Hello, world!");
return 0;

}
19 changes: 19 additions & 0 deletions c/swap/shubhamdpatil_swap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* @file: shubhamdpatil_swap.c
*/

#include <stdio.h>

#define swap(x, y) ((x ^= y), (y ^= x), (x ^= y))

int main()
{
int a, b;
scanf("%d %d", &a, &b);
printf("Before swap: %d, %d\n", a, b);

swap(a, b);
printf("After swap: %d, %d\n", a, b);
return 0;
}

1 change: 1 addition & 0 deletions coffeescript/wzhouwzhou_add.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add = (a, b) -> a + b
1 change: 1 addition & 0 deletions coffeescript/wzhouwzhou_subtract.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
subtract = (a, b) -> +a - +b
13 changes: 13 additions & 0 deletions cplusplus/ZombieChibiXD_Palindrome.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <iostream>
#include <string>

bool isPalindrome(std::string input) { return input == std::string(input.rbegin(), input.rend()); }

int main()
{
std::string input = "able was I ere I saw elba" ;
//std::cout << "Input : ";
//getline (std::cin, input);
std::cout << "It is " << (isPalindrome(input) ? "" : "not ") << "a palindrome";
}

1 change: 1 addition & 0 deletions go/wzhouwzhou_add.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
func add(a, b int) int { return a + b }
14 changes: 14 additions & 0 deletions honorary-one-line-wonders/cplusplus/U3X_check_square.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <iostream>

using namespace std;

void issquare(long long int a){
int flag=1; for(long long i=1;i<=a/2+1;i++){ if(i*i==a) {cout<<"it is a square number\n";flag=0;} }if(flag==1) cout<<"Not a square number\n";
}

int main(){
long long int a;
cin>>a;
issquare(a);
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
pair<ll,ll> maxsum(ll arr[],ll n)
{
ll sum=0;
ll max=0;
pair<ll,ll>p;
ll x=0,y=0;
for(ll i=0;i<n;i++)
{
sum+=arr[i];
if(sum>max){max=sum;y=i;}
if(sum<0){sum=0;x=i+1;}

}
p.first=x;
p.second=y;
return p;
}

int main()
{
int n;
cin>>n;
ll arr[n];
for(ll i=0;i<n;i++)cin>>arr[i];
pair<ll,ll>p=maxsum(arr,n);
cout<<p.first<<" "<<p.second<<endl;
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int countingValleys(int n, string s) {


int sum=0;
if(s[0]=='U')sum++;
else sum--;
int count=0;
if(sum<0)count++;
for(int i=1;i<n;i++)
{
if(s[i]=='D')sum--;
else sum++;
if(s[i]=='D' && sum==-1)count++;
}
return count;

}

int main()
{
int n;
cin>>n;
string s;
cin>>s;
cout<<countingValleys(n,s)<<endl;
return 0;
}
5 changes: 5 additions & 0 deletions honorary-one-line-wonders/javascript/vetlix_array_map.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const map = (arr, cb) => {
let i = arr.length, result = Array(i);
while (i--) result[i] = cb(arr[i], i, arr);
return result;
};
13 changes: 13 additions & 0 deletions java/sgirabin_Max2Digit.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@


class Max2Digit {

public static int max(int a, int b) {
return Math.max(a,b);
}

public static void main(String[] args) {
System.out.println(Max2Digit.max(5,10));
}

}
1 change: 1 addition & 0 deletions javascript/Xander1233_collatzConjecture.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const collatz = x => x <= 1 ? x : collatz((x % 2) === 0 ? x / 2 : x * 3 + 1);
2 changes: 2 additions & 0 deletions javascript/Xander1233_convert_number_to_one_or_bigger.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// This will check if a number is 0 or smaller and then converts it. If 0, to 1. If n < 0, to -n
const convert = (n) => { return (-(~(n ^ 0))) < 0 ? (-(~(n ^ 0))) != -1 ? (-(-(~(n ^ 0)))) + 1 : (-(-(~(n ^ 0)))) : (-(~(n ^ 0))) != 1 ? (-(~(n ^ 0))) - 1 : (-(~(n ^ 0))); }
1 change: 1 addition & 0 deletions javascript/ZombieChibiXD_Palindrome.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const palindrome = (text) => text.toLowerCase() == text.toLowerCase().split("").reverse().join("");
1 change: 1 addition & 0 deletions javascript/rpxs_add.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const add = (a, b) => a + b;
1 change: 1 addition & 0 deletions javascript/rpxs_subtract.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const subtract = (a, b) => a - b
3 changes: 3 additions & 0 deletions javascript/unique/wzhouwzhou_unique_values.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const values = [1, 2, 3, 4, 5, 1, 1, 1, 3];

const unique = [void(0)].map((e, i, arr) => new Set(values).forEach(v => arr.push(v)) || arr)[0].slice(1);
1 change: 1 addition & 0 deletions javascript/vetlix_deepflat_array.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const deepFlat = arr => arr.flat(Infinity);
1 change: 1 addition & 0 deletions javascript/vetlix_empty_array.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const empty = arr => arr.length = 0;
4 changes: 4 additions & 0 deletions javascript/wzhouwzhou_check_brackets.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions nodejs/hello/kannagikazuko_hello_world.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
void(process.stdout.write('Hello, world!\r\n\0'));
1 change: 1 addition & 0 deletions nodejs/tacticaltechjay_coinFlip.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Math.floor(Math.random() * 2) === 1 ? console.log('Heads!') : console.log('Tails!')
1 change: 1 addition & 0 deletions nodejs/wzhouwzhou_delay.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(t = 1000) && Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, t)
2 changes: 2 additions & 0 deletions powershell/Astronaut/rpstester_ListOfPeopleInSpace.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(Invoke-WebRequest "http://api.open-notify.org/astros.json" | ConvertFrom-Json).people
#note, I got the idea from PowerShell.com a while ago, but I cannot find it now.
3 changes: 3 additions & 0 deletions powershell/turbosnute_strongpassword.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Generates a random strong 20 chars long password.
# If you want to change the length of the password you can cange 20 inside the brackets before the -join to somethin else.
([char[]]([char]33..[char]95) + ([char[]]([char]97..[char]126)) + 0..9 | Sort-Object {Get-Random})[0..20] -join ''
3 changes: 3 additions & 0 deletions python/approximate_pi/yashagarwal1999_get_Approximate_Pi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pi=lambda get_approx_pi:4 * sum(-float(k%4 - 2) / k for k in range(1, 2*val+1, 2))
val=int(input('Number of iterations'))
print(pi(val))
3 changes: 3 additions & 0 deletions python/factorial/factorial_n6wbi6.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fact = lambda x: 1 if x == 0 else x * fact(x-1)
#testing it
print(fact(25))
1 change: 1 addition & 0 deletions python/hello/antonio32a_world.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import __hello__
1 change: 1 addition & 0 deletions python/mirandars_par-perfect-squares.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[elemento**2 for elemento in range(11) if elemento%2==0]
1 change: 1 addition & 0 deletions python/mirandars_parity-test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
par = lambda x:True if x%2==0 else False
3 changes: 3 additions & 0 deletions python/mspatel927_Greater_Than.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Returns a positive number if x is > y, 0 if they are equal, or a negative number if x is < y
def greaterThan(x, y):
return (x-y)
3 changes: 3 additions & 0 deletions python/mspatel927_Random_Card_Draw.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
def mean(list):
return sum(list)/len(list)

16 changes: 16 additions & 0 deletions python/prathimacode-hub_ordered_prepend_string_num.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#Consider the program that takes in a string and a list of numbers.
#It will prepend the string to each of the numbers and return a string of this new list separated by commas.
#For example, foo('$', range(5)) would return '$0, $1, $2, $3, $4'.
#A naive coder will do this-
#
#def foo(string, numbers):
# output = ''
# for i in range(len(numbers)):
# if i > 0:
# output += ', '
# output += string + str(numbers[i])
# return output
#
# Here is an elegant way with Output $0, $1, $2, $3, $4-

def foo(string, numbers): return ', '.join(map(lambda s,n:s+str(n), [string for i in numbers], numbers))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print '\n'.join("%i Byte = %i Bit = largest number: %i" % (j, j*8, 256**j-1) for j in (1 << i for i in xrange(8)))
6 changes: 6 additions & 0 deletions python/predator21x_decimal_conversion.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dec = 344

print("The decimal value of",dec,"is:")
print(bin(dec),"in binary.")
print(oct(dec),"in octal.")
print(hex(dec),"in hexadecimal.")
11 changes: 11 additions & 0 deletions python/sorting/ngweihow_bogosort.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'''
Bogosort created using lambda.
@author: ngweihow (github.com/ngweihow)
'''
from random import sample

b_sort = lambda ls: ls if all(ls[i] <= ls[i+1] for i in range(len(ls)-1)) else b_sort(sample(ls, len(ls)))

# Tests (PLEASE DO NOT TEST WITH LARGE LIST INPUT, BOGOSORT IS HIGHLY INEFFICIENT)
print(b_sort([4,3,2,1]))
3 changes: 3 additions & 0 deletions python/unique/RaInta_unique_array.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
list1 = [1,10,7,1,4]

[x for idx, x in enumerate(list1) if x not in list1[:idx]]
7 changes: 7 additions & 0 deletions python/unique/Zylatis_uncommon_elements.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Given two lists, find elements not present in both
# Effectively, a join + delete duplicates. Conversion to set means it nukes repeated elements
s1 = [1,9,23,4]
s2 = [1,4,8,3,7]

# XOR operation on sets
print(set(s1) ^ set(s2))
9 changes: 9 additions & 0 deletions python/unique/yashagarwal1999_unique_array.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
def uni(arr):
li=[]
[li.append(i) for i in arr if not li.count(i)]
return li

list1 = [10, 20, 10, 30, 40, 40]
print(getunique(list1))


5 changes: 5 additions & 0 deletions r/prime/KKulma_find-prime-number.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
is.prime <- function(n) n == 2L || all(n %% 2L:ceiling(sqrt(n)) != 0)

# test
test_vec <- 0:10
sapply(test_vec, is.prime)
Loading

0 comments on commit 5507d93

Please sign in to comment.