This file contains hidden or 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 java.io.File; | |
import java.io.FileNotFoundException; | |
import java.util.Scanner; | |
class SumOfIntegers { | |
public static void main(String[] args) { | |
String pathToFile = args[0]; | |
File file = new File(pathToFile); | |
int sum = 0; | |
try (Scanner scanner = new Scanner(file)) { |
This file contains hidden or 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
(defun fizzbuzz (n) | |
(cond ((eq (mod n 15) 0) 'fizzbuzz) | |
((eq (mod n 3) 0) 'fizz) | |
((eq (mod n 5) 0) 'buzz) | |
(t n))) | |
(loop for i from 1 to 100 | |
do (print (fizzbuzz i))) |
This file contains hidden or 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
# Create directory if it doesn't exist | |
[ -d ${1:-64} ] || mkdir ${1:-64} | |
# Put all resized images into the new directory | |
for file in *.jpg; do | |
magick "$file" -resize ${1:-64}x${1:-64} "./${1:-64}/${file%.jpg}_${1:-64}.jpg" | |
done |
This file contains hidden or 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
(deftheme ZorinBlue-Dark | |
"Emacs theme for Zorin OS dark mode with blue tint") | |
(custom-theme-set-faces | |
'ZorinBlue-Dark | |
'(cursor ((t (:background "#bde6fb")))) | |
'(fixed-pitch ((t (:family "Monospace")))) | |
'(variable-pitch ((((type w32)) (:foundry "outline" :family "Arial")) (t (:family "Sans Serif")))) | |
'(escape-glyph ((((background dark)) (:foreground "cyan")) (((type pc)) (:foreground "magenta")) (t (:foreground "brown")))) | |
'(minibuffer-prompt ((t (:foreground "CadetBlue1")))) |
This file contains hidden or 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
(require 'org) | |
(plist-put org-format-latex-options :scale 3) | |
(exec-path-from-shell-copy-env "PATH") | |
(setq web-mode-indent-style 2) | |
(setq web-mode-code-indent-offset 2) | |
(setq web-mode-markup-indent-offset 2) | |
(setq-default css-indent-offset 2) |
This file contains hidden or 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
function isprime(N) | |
if N < 2 | |
return false | |
end | |
a = rand(1:(N - 1)) | |
return powermod(a, N - 1, N) == 1 | |
end |
This file contains hidden or 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
# Note that Julia has a built-in invmod function already | |
function myinvmod(A, C) | |
for B ∈ 0:(C-1) | |
if mod(A*B, C) == 1 | |
return B | |
end | |
end | |
return A | |
end |
This file contains hidden or 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 <stdio.h> | |
#include <string.h> | |
char* reverse(char* in); | |
void swap(char* s, int a, int b); | |
int main(int argc, char** argv) { | |
if (argv[1]) { | |
printf("%s\n", reverse(argv[1])); | |
} else { |