Skip to content

Instantly share code, notes, and snippets.

View pczajkowski's full-sized avatar
🙉
I have no idea what I'm doing

Piotr Czajkowski pczajkowski

🙉
I have no idea what I'm doing
View GitHub Profile
private static async Task<List<string>> DownloadTMXsAsync(List<TMInfo> tms)
{
List<Task> tasks = new List<Task>();
List<string> tmxs = new List<string>();
foreach (var tm in tms)
{
tasks.Add(Task.Run(async () =>
{
var result = await _memoQTM.DownloadTMXAsync(".", tm.Guid);
if (result.status.Equals("ok", StringComparison.InvariantCultureIgnoreCase))
public static class ReportFactory
{
public static IReport<T> CreateReport<T>()
{
if (typeof(T) == typeof(OrdersInfoBiWeekly))
return (IReport<T>) new OrdersInfoBiWeekly();
if (typeof(T) == typeof(ContentTypeInfo))
return (IReport<T>) new ContentTypeInfo();
@pczajkowski
pczajkowski / bubble.c
Created December 27, 2017 12:54
Sorting algorithms in C
void bubbleSort(int list[], int listLength) {
int doItAgain = 0;
for (int i = 0; i < listLength; i++) {
int thisValue = list[i];
int nextValue = (i + 1 < listLength) ? list[i+1] : INT_MAX;
if (nextValue < thisValue) {
list[i] = nextValue;
list[i+1] = thisValue;
@pczajkowski
pczajkowski / Djikstra.cs
Created December 21, 2017 11:10
Djikstra algorithm for C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
// Adapted from JavaScript example in The Imposter's Hanbook by Rob Conery
// Doesn't support negative edges!
namespace Djikstra
{
@pczajkowski
pczajkowski / BellmanFord.cs
Last active March 16, 2022 11:42
Bellman Ford Algorithm in C#
using System;
using System.Collections.Generic;
using System.Linq;
// Adapted from JavaScript example in The Imposter's Handbook by Rob Conery
namespace BellmanFord
{
class Path
{
#get time
MYTIME=$(date)
#get IPs
IP=$(/sbin/ip -o -4 addr list | awk '{print $2 ": ", $4}')
#remove linebreak
IPF=$(echo $IP)
#json content
post='{"public":false,"files":{"IP.txt":{"content":"'$MYTIME' : '${IPF}'"}}}'
#create a command
crl="curl --header 'Authorization: bearer YOUR_TOKEN_HERE' --header 'Accept: application/json' --header 'Content-type: application/json' --request POST --data '${post}' https://api.github.com/gists"