Skip to content

Instantly share code, notes, and snippets.

View ram0973's full-sized avatar
:octocat:
Thinking

ram0973 ram0973

:octocat:
Thinking
View GitHub Profile
@ram0973
ram0973 / unblock.ps1
Created April 30, 2019 08:09
Unblock files in current directory with PowerShell
Get-ChildItem -Path . -Recurse | Unblock-File
@ram0973
ram0973 / mirrors.sh
Created May 21, 2019 12:37
Oneliner that select best (by download speed) mirror based on mirrors.ubuntu.com for yours ip.
curl -s http://mirrors.ubuntu.com/mirrors.txt | xargs -n1 -I {} sh -c 'echo `curl -r 0-102400 -s -w %{speed_download} -o /dev/null {}/ls-lR.gz` {}' |sort -g -r |head -1| awk '{ print $2 }'
@ram0973
ram0973 / krb5.conf
Created August 16, 2019 09:56 — forked from skokhanovskiy/krb5.conf
Example configuration files for libkrb5 and sssd for authentication with Active Directory
# This is an example of krb5.conf for authentication with Active Directory
# Tested on libkrb5-3 1.15-1+deb9u1
[libdefaults]
default_realm = EXAMPLE.COM
dns_lookup_realm = true
dns_lookup_kdc = true
forwardable = true
# Values for next three parameters should be used from Default Domain Policy GPO
<div class="container">
<div class="score">
score: <span class="score_val">0</span>
</div>
<div class="canvas-wrapper">
<canvas width="400" height="400"></canvas>
</div>
<div class="controls">
<button class="btn-start">Start</button>
<button class="btn-pause">Pause</button>
@ram0973
ram0973 / java
Last active March 31, 2020 18:53
Java multiplication table
public class Solution {
public static void main(String[] args) {
for (int x = 2; x <= 6; x += 4) {
for (int y = 1; y <= 9; y++) {
for (int z = x; z <= x + 3; z++) {
System.out.print(String.format("%d * %d = %-2d ", z, y, y * z));
}
System.out.println();
}
System.out.println();
@ram0973
ram0973 / fix-wsl2-dns-resolution
Created April 20, 2020 06:53 — forked from coltenkrauter/fix-wsl2-dns-resolution
Fix DNS resolution in WSL2
1. Create a file: /etc/wsl.conf.
2. Put the following lines in the file in order to ensure the your DNS changes do not get blown away
[network]
generateResolvConf = false
3. In a cmd window, run wsl --shutdown
4. Restart WSL2
5. Create a file: /etc/resolv.conf. If it exists, replace existing one with this new file.
6. Put the following line in the file
@ram0973
ram0973 / a-infinality-w10-config.sh
Created May 18, 2020 15:32 — forked from sorenvonsarvort/a-infinality-w10-config.sh
Windows 10-like font rendering config for Linux
# make sure You have installed the infinality patches
export INFINALITY_FT_FILTER_PARAMS="8 17 50 17 8"
export INFINALITY_FT_GRAYSCALE_FILTER_STRENGTH="0"
export INFINALITY_FT_FRINGE_FILTER_STRENGTH="55"
export INFINALITY_FT_AUTOHINT_HORIZONTAL_STEM_DARKEN_STRENGTH="0"
export INFINALITY_FT_AUTOHINT_VERTICAL_STEM_DARKEN_STRENGTH="0"
export INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="20"
export INFINALITY_FT_CHROMEOS_STYLE_SHARPENING_STRENGTH="0"
export INFINALITY_FT_STEM_ALIGNMENT_STRENGTH="0"
@ram0973
ram0973 / Main.java
Created January 31, 2021 11:12
Deepest file or directory
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
class Main {
public static void main(String[] args) throws IOException {
Path longestPath = Files.walk(Paths.get("D:\\Downloads\\basedir"))
.max(Comparator.comparingInt(Path::getNameCount)).orElseThrow(NullPointerException::new);
@ram0973
ram0973 / deleteDirRecursively.java
Created January 31, 2021 11:20
deleteDirRecursively in Java
public void deleteDirRecursively(File dir) {
File[] children = dir.listFiles();
for (File child : children) {
if (child.isDirectory()) {
deleteDirRecursively(child);
} else {
child.delete();
}
}
@ram0973
ram0973 / hell.java
Created February 21, 2021 09:02
Фабрика фабрик
class TestDrive {
public static void main(String[] args) throws InterruptedException {
BurgerStore mcDonalds = new McDonStore();
BurgerStore burgerKing = new BurgerKingStore();
Burger burger;
System.out.println("-Hello, one McDonalds style cheeseburger");
System.out.println("-Okay! Please wait for a sec, -Calling to the McDonaldsStore. -Cheeseburger");
burger = mcDonalds.orderBurger(Burger.CHEESE);