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
fulload() { dd if=/dev/zero of=/dev/null | dd if=/dev/zero of=/dev/null | dd if=/dev/zero of=/dev/null | dd if=/dev/zero of=/dev/null & }; fulload; read; killall dd |
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
-module(leap). | |
-export([is_leap_year/1]). | |
is_leap_year(Year) when is_integer(Year), Year >= 0,Year rem 4 =:= 0, Year rem 100 > 0 -> | |
true; | |
is_leap_year(Year) when is_integer(Year), Year >= 0,Year rem 400 =:= 0 -> | |
true; | |
is_leap_year(_) -> false. |
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
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"log" | |
) | |
func main() { | |
files, err := ioutil.ReadDir("path to dir") |
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/bash | |
# Script iptables by olto | |
# Réinitialisation | |
iptables -F | |
echo - Réinitialisation... : [OK] | |
# Suppression des chaînes utilisateurs |
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/bash | |
SLEEP=120 | |
MAX_CONN=20 | |
MY_IP=0.0.0.0 # Configure your IP here | |
while true; do | |
( | |
echo "create table ips (ip string);" | |
echo 'begin transaction;' | |
netstat -an | grep -v ESTABLISHED | grep ${MY_IP}:80 | awk '{print $5}' | cut -f4 -d: | while read IP; do |
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
%% https://www.hackerrank.com/challenges/common-divisors/submissions/code/13608658 | |
% Enter your code here. Read input from STDIN. Print output to STDOUT | |
% Your class should be named solution | |
-module(solution). | |
-export([main/0]). | |
-compile(export_all). | |
main() -> | |
{ok,[A]}=io:fread("", "~d"), | |
scanner(A). |
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
func reverseVowels(s string) string { | |
//A, E, I, O, and U | |
vowlesMap := map[byte]bool{ | |
'a':true,'A':true, | |
'e': true,'E':true, | |
'i':true,'I':true, | |
'o':true,'O':true, | |
'u':true,'U':true} | |
vowlesValues := []byte{} | |
n:= 0 |
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
import "strings" | |
import "strconv" | |
func solveEquation(equation string) string { | |
eqnSides := strings.Split(equation, "=") | |
leftHandSide, rightHandSide := eqnSides[0], eqnSides[1] | |
lHV,lHx := getSideSum(leftHandSide) | |
rHV,rHx := getSideSum(rightHandSide) | |
if lHx == rHx && lHV == rHV{ |
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
import "sort" | |
func kClosest(points [][]int, K int) [][]int { | |
sort.SliceStable(points,func(i,j int)bool{ | |
point1 := points[i] | |
point2 := points[j] | |
return distance(point1[0],point1[1]) < distance(point2[0],point2[1]) | |
}) | |
return points[:K] | |
} |
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
import "sort" | |
/** | |
* Definition for an interval. | |
* type Interval struct { | |
* Start int | |
* End int | |
* } | |
*/ | |
func insert(intervals []Interval, newInterval Interval) []Interval { |
OlderNewer