Skip to content

Instantly share code, notes, and snippets.

View hamidb80's full-sized avatar
😶
Life is what you choose it to be...

Hamid Bluri hamidb80

😶
Life is what you choose it to be...
View GitHub Profile
@hamidb80
hamidb80 / linux_change_dns.sh
Last active April 19, 2024 10:45
change the DNS setting of your linux system
#!/bin/sh
LOC="/etc/resolvconf/resolv.conf.d/head"
if [[ $1 = "remove" ]]; then
echo "nameserver 1.1.1.1" | sudo tee $LOC
elif [[ $1 = "begzar" ]]; then # begzar.ir
echo "nameserver 185.55.226.26" | sudo tee $LOC
echo "nameserver 185.55.225.25" | sudo tee -a $LOC
## originally writeen for brother Omar. thanks to:
## https://github.com/nramos0/binhex4-rs/
## https://gist.github.com/i-e-b/fe0a0158ae61973802a9
import std/[strutils, sequtils, os]
type
DecodedHqxContent = distinct string
@hamidb80
hamidb80 / p3.c
Last active November 16, 2023 13:19
TA Basic programming 1402 HW1
#include <stdio.h>
int main()
{
int
x = 8,
m = 6,
y = (x ^ 2 < m + 4) ? (4 * m) : (8 * m);
@hamidb80
hamidb80 / p2.c
Created November 16, 2023 13:12
TA Basic programming 1402 HW1
#include <stdio.h>
int main()
{
int
x = 10,
y = 15,
m = 4;
@hamidb80
hamidb80 / p1.c
Created November 16, 2023 13:12
TA Basic programming 1402 HW1
#include <stdio.h>
int main()
{
float
y = 7,
m = 4,
p = 5,
k = 8,
@hamidb80
hamidb80 / review.c
Created November 16, 2023 13:08
TA Basic programming 1402 HW1
#include <stdio.h>
int main()
{
// :::::: defining variable styles ::::::
// way 1
{
int a, b, c, d;
a = 1;
#include <stdio.h>
int main()
{
int
y = 4,
m = 2,
p = 3;
float
@hamidb80
hamidb80 / openMP-parallel-for-shared-local.c
Last active November 2, 2023 07:30
openMP parallel for loop with shared & local variables
#include <stdio.h>
#include <omp.h>
int main(){
int partial_Sum, total_Sum;
#pragma omp parallel private(partial_Sum) shared(total_Sum)
{
partial_Sum = 0;
total_Sum = 0;
@hamidb80
hamidb80 / python_def_to_nim_proc.nim
Created June 16, 2023 07:00
converts python's way of defining function to Nim way.
import std/macros
import macroplus
# ----- impl
template emp: untyped = newEmptyNode()
func resolveParams(rawParams: openArray[NimNode]): seq[NimNode] =
template init =
result.add newNimNode nnkIdentDefs
import std/strutils
type BookFeatures = enum
bfIntroAndDownload = "معرفی و دانلود"
bfIntroAndPurchase = "معرفی، خرید و دانلود"
bfFreeContent = "رایگان"
bfBook = "کتاب"
bfAudioBook = "کتاب صوتی"
bfPodcast = "پادکست"